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

你要保守你心,胜过保守一切。

本文来自博客园,作者:刘俊涛的博客,转载请注明原文链接:https://www.cnblogs.com/lovebing/p/15735437.html

原文地址:https://www.cnblogs.com/lovebing/p/15735437.html