diff --git a/Server/application/command/TaskSchedulerCommand.php b/Server/application/command/TaskSchedulerCommand.php index b91bb06d..0ad3cc48 100644 --- a/Server/application/command/TaskSchedulerCommand.php +++ b/Server/application/command/TaskSchedulerCommand.php @@ -81,8 +81,8 @@ class TaskSchedulerCommand extends Command return false; } - // 设置日志目录 - $this->logDir = runtime_path() . 'log' . DIRECTORY_SEPARATOR; + // 设置日志目录(注意要使用全局函数,避免命名空间影响) + $this->logDir = \runtime_path() . 'log' . DIRECTORY_SEPARATOR; if (!is_dir($this->logDir)) { mkdir($this->logDir, 0755, true); } @@ -333,7 +333,8 @@ class TaskSchedulerCommand extends Command } // 构建命令 - $thinkPath = root_path() . 'think'; + // 使用项目根目录下的 think 脚本(同命令行 php think) + $thinkPath = \root_path() . 'think'; $command = "php {$thinkPath} {$task['command']}"; if (!empty($task['options'])) { foreach ($task['options'] as $option) {