ThinkPHP 命令行工具

复习一下 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'],
    ],
    // 其他更多的模块定义
];

posted @ 2021-12-27 10:53  刘俊涛的博客  阅读(196)  评论(0编辑  收藏  举报