快速生成模块
生成一个test
模块的指令如下:
>php think build --module test
表示自动生成test
模块,自动生成的模块目录包含了config
、controller
、model
和view
目录以及common.php
公共文件。
批量生成模块
如果需要批量生成多个模块的目录和文件,需要定义规则文件build.php
并放入应用目录(application)下面。
return [
// 定义demo模块的自动生成
'demo' => [
'__file__' => ['tags.php', 'user.php', 'hello.php'],
'__dir__' => ['config', 'controller', 'model', 'view'],
'controller' => ['Index', 'Test', 'UserType'],
'model' => [],
'view' => ['index/index'],
],
// 定义test模块的自动生成
'test'=>[