thinkphp5.1单模块

1、
// 是否支持多模块
'app_multi_module' => false,
// 自动搜索控制器
'controller_auto_search' => true,
2、
去掉application目录下的 Index 文件夹,
在这里目录下创建controller、model、view三个目录(可以先只创建controller,用到的时候在创建其他的)

3、修改文件route/route.php
把默认的Route::get('hello/:name', 'index/hello'); 注释掉

4、
修改controller目录下默认Index类的命名空间: namespace app\controller;

4、在application目录下新建一个类Study

class Study
{
    public function index()
    {
        return "study";
    }

    public function testStudy($name)
    {
        return "testStudy +++ " . $name;
    }
}

  

5、访问http://localhost:8090/study/testStudy/name/hello
输出testStudy +++ hello

6、访问http://localhost:8090
默认访问的是Index控制器的index方法

相关文章:

  • 2021-04-03
  • 2021-12-14
  • 2022-12-23
  • 2021-07-24
  • 2021-08-11
  • 2022-12-23
  • 2021-12-22
猜你喜欢
  • 2021-06-24
  • 2022-12-23
  • 2021-12-04
  • 2021-10-29
  • 2022-12-23
  • 2022-12-23
  • 2021-05-16
相关资源
相似解决方案