@@ -400,6 +400,9 @@ function str_substr($str, int $length = 30)
*/
function app_end()
{
+ if (\request()->isCli()) {
+ exit(PHP_EOL);
+ }
throw new HttpResponseException(Response::create());
}
@@ -82,7 +82,7 @@ class Timer extends Command
public function start()
// 每隔n秒执行一次
- return $this->timer = \Workerman\Lib\Timer::add($this->interval, function () use (&$task) {
+ return $this->timer = \Workerman\Lib\Timer::add($this->interval, function () {
try {
// 这里执行系统预设的定时任务事件
echo 'timer...' . PHP_EOL;