tp5模塊自動生成
1build.php配置要生成的目錄
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <[email protected]
// +----------------------------------------------------------------------
return [
// 生成應用公共文件
‘__file__‘ => [‘common.php‘, ‘config.php‘, ‘database.php‘],
// 定義demo模塊的自動生成 (按照實際定義的文件名生成)
‘demo‘ => [
‘__file__‘ => [‘common.php‘],
‘__dir__‘ => [‘behavior‘, ‘controller‘, ‘model‘, ‘view‘],
‘controller‘ => [‘Index‘, ‘Test‘, ‘UserType‘],
‘model‘ => [‘User‘, ‘UserType‘],
‘view‘ => [‘index/index‘],
],
// 其他更多的模塊定義
‘admin‘ => [
‘__file__‘ => [‘common.php‘],
‘__dir__‘ => [‘behavior‘, ‘controller‘, ‘model‘, ‘view‘],
‘controller‘ => [‘Index‘, ‘Test‘, ‘UserType‘],
‘model‘ => [‘User‘, ‘UserType‘],
‘view‘ => [‘index/index‘],
],
];
2:我們切換到windows命令行,我們項目根目錄下
運行
php think build --config build.php
即可生成。
tp5模塊自動生成