<?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===
请教一下,是我哪里做错了吗?
最佳答案