自定义命令行

RapPhp 支持命令行拓展


只需要写个类集成只 Command下面是 aop 的命令行文件可以做参考

  1. class AopFileBuild extends Command{
  2. public function configure(){
  3. $this->name('aop')
  4. ->asName("生成AOP需要的文件")
  5. ->param("-d",true,'删除文件',false)
  6. ->des("会根据search去查数据库生成所有表前缀为search的record模型文件,
  7. 生成的类文件前缀去除prefix
  8. 生成的文件在 runtime/model
  9. ");
  10. }
  11. public function run($d){
  12. if($d){
  13. Aop::clear();
  14. $this->writeln("AOP文件已删除成功,需要时可以重新生成");
  15. }else{
  16. Aop::buildProxy();
  17. $this->writeln("AOP文件生成成功,文件在".RUNTIME.'aop下');
  18. }
  19. }
  20. }

run方法的参数随便你写 会自动更具命令行的输入传入的

上一篇:swoole_http服务器   下一篇:部署