我花了几个小时来搜索使用 php 执行 cron 的信息,但对我没有任何用处……我想每 30 分钟后执行一次我的 php 脚本……这是 myscript.php
<?php
date_default_timezone_set("Asia/Calcutta");
$datetime=date("Y-m-d G.i:s", time());
file_put_contents("aaaaa.txt", "The current time is: $datetime\r\n", FILE_APPEND);
?>
我用来执行 cron 命令的脚本...是 crontest.php
</php
$abc=array();
$dir=dirname(__FILE__);
echo exec("'*/30 * * * * /bin/usr/php $dir/myscript.php' 2>&1", &$abc);
echo $output;
?>
我尝试了许多不同的命令......比如......
"'crontab -l */30 * * * * /bin/usr/php $dir/myscript.php' 2>&1"
"'crontab -l */30 * * * * php myscript.php' 2>&1"
但没有什么能妨碍我..我不明白我还能做什么..请有人帮忙,请在执行 crontest.php 我收到错误“sh:*/30 * * * * /bin/usr/php /home /content/71/9988871/html/examples/myscript.php:没有这样的文件或目录”