我的应用程序在 hostgater.com 上运行。 我在我的服务器中创建了一个 Cron 作业调度程序并设置所有这些参数。
目前效果良好
command parameter like /home3/user/public_html/sendemial.php.
它不起作用,我尝试执行 MVC Controller 操作 URL,例如
command parameter like http://voola.org/user/sendemail
我也尝试过使用 iframe,但它不起作用。我非常担心在 Hostgater 服务器中执行直接 url。
任何帮助将不胜感激:)
最佳答案
examole谢谢@Orangepill,你太棒了。使用curl 发挥其工作魅力。下面是我的代码示例
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://sadf/profiles/emailalert");
curl_setopt($ch, CURLOPT_HEADER, 0);
// grab URL and pass it to the browser
$result=curl_exec($ch);
// close cURL resource, and free up system resources
curl_close($ch);
if($result){
echo "execute by curl ok and sending mail";
}else{
echo "not execute curl funation";
}
关于php - 我如何使用浏览直接 URL 执行 Cron 作业,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18798968/