【发布时间】:2012-03-21 03:28:42
【问题描述】:
可能重复:
What is the canonical way to determine commandline vs. http execution of a PHP script?
在 php 中有一些用于 cronjob 的“条件”标签吗?我想做什么:
if(cron_job_executing_this_php_file)
{
do something
}
elseif($_SERVER['REMOTE_ADDR'] = "blah.bl.ah.bl")
{
do something
}
我可以这样做吗?
【问题讨论】:
-
为什么不为您的 cron 作业制作一个单独的 php 文件?
-
如果您的 crontab 能够发送 $_GET 变量 0 3 * * * sudo /usr/local/bin/myfile.php?cron=true