ThinkPHP5快速入门 初学memo - URL问题
2017/2/10
快速入门(一):基础
把Index控制器类的方法修改为:
namespace app\index\controller;
class Index
{
public function hello()
{
return ‘hello,thinkphp!’;
}
public function test()
{
return '这是一个测试方法!';
}
protected function hello2()
{
return '只是protected方法!';
}
private function hello3()
{
return '这是private方法!';
}
}
当我们访问如下URL地址的时候,前面两个是正常访问,后面两个则会显示异常。
http://tp5.com/index.php/index/index/hello
http://tp5.com/index.php/index/index/test
http://tp5.com/index.php/index/index/hello2
http://tp5.com/index.php/index/index/hello3
遇到问题
因为使用了教程里命令行创建新模块demo(\TP5\application\demo\),
所以上面的URL应该为:
http://localhost:8888/index.php/demo/index/test