首页 新闻 会员 周边

thinkphp5怎么运行控制器里的方法?

0
悬赏园豆:15 [已关闭问题] 关闭于 2019-01-23 22:52

初学,为什么我在app\index\controller、index.php里加上
public function test()
{
return '<h1>hello niunan...</h1>';
}
然后运行 http://localhost:10003/public/index.php/index/test

运行
http://localhost:10003/public/index.php/index/index是正常显示的

牛腩的主页 牛腩 | 初学一级 | 园豆:-6
提问于:2019-01-23 22:36
< >
分享
所有回答(1)
0

http://localhost:10003/public/index.php/index/index/test

真实访问是这个。。。我操你妈的THINKPHP。。。。日。。。

application目录下的index目录是模块名

index目录下的controller目录下的index.php 是控制器,名称是index,

index.php里二个方法,一个名字叫index,一个名字叫test

访问的时候是

http://localhost:10003/public/index.php/模块名/控制器名/方法名

牛腩 | 园豆:-6 (初学一级) | 2019-01-23 22:52
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册