复习一下 thinkPHP 命令行工具

命令直接运行服务

我们可以不需要通过配置虚拟域名的方式来访问我们的项目非常方便,只需要在入口文件中 (默认在public目录下) 执行 如下命令

php -S localhost:8181 router.php
php think run

就可以通过localhost:8181来访问我们的项目,8181是端口号

build自动代码生成

#将build 复制到application 目录下
php think build

biuld文件内容

<?php
return [
    // 生成应用公共文件
    '__file__' => ['common.php'],

    // 定义demo模块的自动生成 (按照实际定义的文件名生成)
    'api2'     => [
        '__file__'   => ['common.php'],
        '__dir__'    => ['service', 'controller', 'model', 'view'],
        'controller' => ['Index', 'Test', 'Admin'],
        'model'      => ['User', 'Test'],
        'view'       => ['index/index'],
    ],
    // 其他更多的模块定义
];

相关文章:

  • 2022-01-16
  • 2021-05-04
  • 2021-08-27
  • 2021-04-29
  • 2021-06-28
  • 2021-12-31
  • 2021-04-08
  • 2021-06-08
猜你喜欢
  • 2022-01-13
  • 2022-12-23
  • 2021-12-03
  • 2021-11-30
相关资源
相似解决方案