php cron 作业像浏览器一样使用 $_SERVER['REQUEST_URI']

php cron job acting like browser with $_SERVER['REQUEST_URI']

是否可以创建一个 cron 作业作为普通浏览器发送 $_SERVER['REQUEST_URI']?

因为当我做 /usr/bin/php -q __path_to 我的 php file____

我得到这样的东西

$_SERVER['SHELL'] 
$_SERVER['MAILTO']  
$_SERVER['USER'] 
$_SERVER['PATH'] 
$_SERVER['LANG'] 
$_SERVER['SHLVL'] 
$_SERVER['HOME'] 
$_SERVER['LOGNAME'] 
$_SERVER['_'] 
$_SERVER['PHP_SELF']
$_SERVER['REQUEST_TIME_FLOAT'] 
$_SERVER['REQUEST_TIME']

但是当我从浏览器 运行 时,我得到了更多东西

$_SERVER['CONTEXT_DOCUMENT_ROOT']
$_SERVER['CONTEXT_PREFIX']
$_SERVER['DOCUMENT_ROOT']
$_SERVER['GATEWAY_INTERFACE']
$_SERVER['HTTP_ACCEPT']
$_SERVER['HTTP_ACCEPT_ENCODING']
$_SERVER['HTTP_ACCEPT_LANGUAGE']
$_SERVER['HTTP_CONNECTION']
$_SERVER['HTTP_COOKIE']
$_SERVER['HTTP_HOST']
$_SERVER['HTTP_USER_AGENT']
$_SERVER['PATH']
$_SERVER['QUERY_STRING']
$_SERVER['REDIRECT_STATUS']
$_SERVER['REMOTE_ADDR']
$_SERVER['REMOTE_PORT']
$_SERVER['REQUEST_METHOD']
$_SERVER['REQUEST_SCHEME']
$_SERVER['REQUEST_URI']
$_SERVER['SCRIPT_FILENAME']
$_SERVER['SCRIPT_NAME']
$_SERVER['SERVER_ADDR']
$_SERVER['SERVER_ADMIN']
$_SERVER['SERVER_NAME']
$_SERVER['SERVER_PORT']
$_SERVER['SERVER_PROTOCOL']
$_SERVER['SERVER_SIGNATURE']
$_SERVER['SERVER_SOFTWARE']
$_SERVER['UNIQUE_ID']
$_SERVER['PHP_SELF']
$_SERVER['REQUEST_TIME_FLOAT']
$_SERVER['REQUEST_TIME']

我也尝试了 lynxcurl 但它似乎并没有这样做...

感谢有人回答

您必须使用 ajax 向服务器发送调用,使用 setTimeout 方法您可以设置时间间隔,在此您必须向服务器发送调用或您的 url 用于发送请求。

但关闭电脑后它不起作用,所以在实施之前请清除所有这些东西。

使用此命令从 url:

运行 cron
wget -O - -q -t 1 http://www.example.com/_path_to_your_php_file_

出于安全原因,我在我的脚本中阻止了 wget...

我终于找到了我需要的东西:

这是一个 chrome 扩展程序 http://www.crontabs.org/ 您可以设置一个页面,每隔 x 分钟、小时等打开并重新加载...

感谢其他回答