public static function buildBehaviors($module, $controller) { $tempPath = config::get('behaviors_path'); $file = config::app_path() . '/' . $module . '/behaviors/' . $controller . '.php'; if (!is_file($file)) { $content = file_get_contents($tempPath); $content = str_replace(array('[MODULE]', '[CONTROLLER]'), array($module, $controller), $content); if (false) { $content = preg_replace('/namespace\\s(.*?);/', '', $content, 1); } $dir = dirname($file); if (!is_dir($dir)) { mkdir($dir, 0755, true); } file_put_contents($file, $content); } }
public static function input() { $param = config::param(); $arr = System\Directory::explode($param['0']); if (empty($arr[0]) || empty($arr[1])) { return "[0;41;1m module name is null;Enter module/input\n"; } if (empty($param[1])) { // 普通 Build::buildInput($arr['0'], $arr[1]); } elseif ($param[1] == '--resource') { // 资源 Build::buildInput($arr['0'], $arr[1], config::get('input_resource_path')); } }