zl程序教程

您现在的位置是:首页 >  其他

当前栏目

TP6.0 命令行生成类库文件

文件命令行 生成 类库 TP6.0
2023-06-13 09:17:02 时间

1. 生成控制器


// 默认生成资源控制器,有七个方法资源操作方法
// index、create、save、read、edit、update、delete
php think make:controller Blog

// 创建多级控制器
php think make:controller user/Blog

// 创建index应用下的Blog控制器
php think make:controller index@Blog

// 创建多级控制器
php think make:controller index@user/Profile

// 如果仅仅生成空的控制器则可以加上参数 --plain
php think make:controller User --plain

// 如果只是用于接口开发,可以使用参数 --api
// index、save、read、update、delete
// 默认提供5个操作方法,和资源控制器相比少了 create 和 edit 方法
php think make:controller User --api2. 生成模型

2. 生成模型


php think make:model Blog

php think make:model index@Blog

php think make:model index@user/Profile

3. 生成验证器


php think make:validate User

php think make:validate admin@User

php think make:validate admin@user/Address

4. 生成中间件


注意:命令行不支持直接在应用下创建中间件

php think make:middleware Login

php think make:middleware user/Login