TP5.1 url生成的问题,不知是不是TP有BUG

浏览:628 发布日期:2018/11/27 分类:ThinkPHP5专区
route.php<?php
Route::rule('test','index/test/index');//测试
Route::get('login','Login/index');//登录
application\index\controller\Test.php<?php
namespace app\index\controller;
use think\Controller;
use \think\facade\Url;

class Test extends Controller
{
    public function index()
    {
        $url = Url::build('test');
        echo '<br>====';
        echo '<a href="' , $url , '">' , $url , '</a>';
        echo '===<br>';
        echo '<br>====';
        
        $url = Url::build('login');
        echo '<a href="' , $url , '">' , $url , '</a>';
        echo '===<br>';

        $url = Url::build('index/test/index');
        echo '<br>====';
        echo '<a href="' , $url , '">' , $url , '</a>';
        echo '===<br>';

        $url = Url::build('Login/index');
        echo '<br>====';
        echo '<a href="' , $url , '">' , $url , '</a>';
        echo '===<br>';
    }
}
生成的URL:(没一个是对的)
====/index.php/index/test/test.html===
====/index.php/index/test/login.html===
====http://localhost.localhost/index.php/test.html===
====http://localhost.localhost/index.php/login.html===

请教一下,是我哪里做错了吗?
最佳答案
评论( 相关
后面还有条评论,点击查看>>