/** * 显示命令输入帮助信息 */ public function help() { Stdout::title('This is H2O version ' . \H2O::getVersion()); //命令行引导入口信息 $index = $GLOBALS['argv'][0]; //命令行使用 Stdout::table([['route', 'COMMAND <route> [--option1=value1 --option2=value2 ... ]'], ['example for system module', $index . ' @migrate.create --name=all'], ['example for user define', $index . ' hello.index --test=info']]); //数据迁移模块 Stdout::table([['migrate', 'Manages application migrations', 'Params list'], ['@migrate.create', 'Create a new migrate', '--name=test'], ['@migrate.up', 'Update a new migrate', '--name=test'], ['@migrate.restore', 'Restore a new migrate', '--name=test'], ['@migrate.all', 'Update/Restore all migrate', '--type=up'], ['', '', '--type=restore']]); //后台离线服务程序 Stdout::table([['service', 'Background offline service', 'Params list'], ['@service.start', 'Start a service', '--c=hello.world'], ['@service.cat', 'Cat a service', '--c=hello.world'], ['', '', 'empty is all view all services'], ['@service.stop', 'Stop a service', '--c=hello.world'], ['', '', '--c=hello.world --p=proid'], ['', '', 'empty stop all services']]); //自动化开发工具 Stdout::table([['gii', 'Automation development tools'], ['@gii.web', 'Create web application'], ['@gii.cli', 'Create command line application'], ['@gii.model', 'Create model program '], ['@gii.simple', 'Create simple group application']]); echo Stdout::get(); exit; }
/** * 写入debugger日志 * @param array $data 消耗信息 */ public function debugger($data) { $request = \H2O::getContainer('request'); Stdout::title('Debugger Info ' . date('Y-m-d H:i:s')); Stdout::table([['Route', 'RunTime', 'Memory'], [$request->getRequestUri(), $data['runtime'], $data['memory']]]); $logfile = APP_RUNTIME . DS . 'console' . DS . 'debugger' . DS . date('Ymd') . '.log'; //异常日志文件 $content = Stdout::get(); //内容 H2O\helpers\File::write($logfile, $content); //写入日志信息 }
/** * 命令行使用方法 */ public function actHelp() { Stdout::title('Test system application example!'); Stdout::table([['Method', 'Summary'], ['Test.index', 'Create `sys_user` table'], ['Test.renTable', 'The name of table `sys_user` to `sys_user1`'], ['Test.delTable', 'Delete table `sys_user`'], ['Test.clearTable', '清空表`sys_user`数据'], ['Test.addColumn', '给表`sys_user`添加字段'], ['Test.dropColumn', '删除表`sys_user`的字段']]); return Stdout::get(); }
/** * 命令行使用方法 */ public function actHelp() { Stdout::title('Welcome to First example!'); return Stdout::get(); }