我想在每天早上7点之后发送短信。所以,我试图在HostGator cron作业选项卡中设置cron作业,然后我编写一个命令来运行该命令的脚本
/usr/local/php5/bin/php5 /home/anandagu/public_html/send-sms.php
SMS-代码:
$user=mysql_query("SELECT * FROM `users`");
while($userexe=mysql_fetch_array($user))
{
//SUBSTRING(`od_date`,1,10) = '".$_REQUEST['fromDate']."'
//echo "SELECT count(*) FROM `reminder_activity` WHERE `user`='".$userexe['username']."' AND SUBSTRING(`remainder_date`,1,10)='$dates'";
$remainder=mysql_query("SELECT count(*) FROM `reminder_activity` WHERE `user`='".$userexe['username']."' AND SUBSTRING(`remainder_date`,1,10)='$dates'");
$count=mysql_fetch_array($remainder);
if($count[0] >0)
{
$msg="Hi ". $userexe['username'].", today you have $count[0] remainders, kindly check";
$phone=$userexe['mobile_number'];
sendSMS($phone,$msg);
}
}
但它不适合我。请指导我如何创建cron作业并运行脚本。