work 917 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env php
  2. <?php
  3. use think\App;
  4. use Workerman\Worker as WO;
  5. define('APP_PATH', __DIR__ . '/application/');
  6. bcscale(2);
  7. // 加载框架引导文件
  8. require __DIR__.'/thinkphp/base.php';
  9. App::initCommon();
  10. WO::$logFile=sprintf('%s/workerman.log',RUNTIME_PATH);
  11. WO::$pidFile=sprintf('%s/workerman.pid',RUNTIME_PATH);
  12. abstract class Com{
  13. protected static function log($data){
  14. user_log('commands/'.class_basename(get_called_class()),$data);
  15. }
  16. protected static function logError(\Exception $exception){
  17. user_log('commands/'.class_basename(get_called_class()),[
  18. 'exception'=>$exception->getMessage(),
  19. 'file'=>$exception->getFile().' line:'.$exception->getLine(),
  20. 'trace'=>$exception->getTrace()
  21. ]);
  22. }
  23. }
  24. /*foreach (glob(__DIR__.'/commands/*.php') as $file){
  25. require $file;
  26. }*/
  27. require './commands/mobile_activity.php';
  28. WO::runAll();