use think\Route;
Route::get('/',function(){
return 'Hello,world!';
});---------这段添加到route.php中,访问/,还是欢迎界面啊,不是hello,world!求解
2、
在index模块的index控制器中添加test和hello方法
public function test()
{
return "hello world!!331";
// dump(config());
}
public function hello()
{
return 'my is hello controller';
}然后在route.php中添加return [
'test' =>'test',
'hello' =>'hello',
];然后在访问http://127.0.0.1/hello和http://127.0.0.1/test可以直接输出test和hello方法的结果
my is hello controller
hello world!!331
求解,官方手册中没有提起这种用法啊?巧合吗?
最佳答案