0

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

因为当我做 /usr/bin/php -q __path_to 我的 php 文件____

我得到这样的东西

$_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但它似乎没有这样做......

谢谢如果有人有答案

4

3 回答 3

0

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

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

于 2015-08-13T05:17:16.163 回答
0

使用此命令从 url 运行 cron:

wget -O - -q -t 1 http://www.example.com/_path_to_your_php_file_
于 2015-08-13T05:29:31.210 回答
0

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

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

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

感谢其他答案

于 2015-08-13T06:47:09.710 回答