我需要通过 CLI 运行特定的作业,但我只能选择一个文件 -我不能在其中放置参数。现在,如何让它工作?
我尝试创建 cli_job.php 并通过 CLI 运行它,但它返回主页:
<?php
/* make sure this isn't called from a web browser */
if (isset($_SERVER['REMOTE_ADDR'])) die('CLI-only access.');
/* set the controller/method path */
$_SERVER['PATH_INFO'] = $_SERVER['REQUEST_URI'] = $_SERVER['QUERY_STRING'] = '/controller/method';
$_SERVER["HTTP_HOST"] = "domain.com";
$argv = array("index.php", "controller", "method");
/* call up the framework */
include(dirname(__FILE__).'/index.php');
谢谢