} public function main($argv) { if (count($argv) < 2) { printf("please input help parameter\n"); exit; } if ($argv[1] === 'stop') { $this->stop(); } else { if ($argv[1] === 'start') { $this->start(); } else { $this->help($argv[0]); } } } } /* *写日志 **/ function write_log($msg) { $msg = sprintf("%s,%s\n", date('Y-m-d H:i:s'), $msg); file_put_contents('/www/hx9999.com/log.hx9999.com/mq.' . date("Y-m-d") . '.log', $msg, FILE_APPEND); } // 定义可以同时执行的进程数量 define('MAX_CONCURRENCY_JOB', 20); $cgse = new Example(); $cgse->main($argv);