thinkphp传参第一个回应函数
1.Test.php
<?php
namespace app\sample\controller;
class Test
{
public function hello($id,$name){
echo $id;
echo '|';
echo $name."<br>";
return 'hello,world!';
}
}
2.配置路由
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
//use think\Route;
Route::get('hello/:id','sample/Test/hello');

这里遇上一个问题,为什么使用 use think\Route就会错误
打开报错

查看报错

解决方法:
use think\facade\Route;

浙公网安备 33010602011771号