|
楼主 |
发表于 2013-12-10 15:05:10
|
显示全部楼层
- <?
- include_once("./auth.php");
- //include_once("inc/conn.php"); 2013增强版无需引用了
- include_once("inc/utility_sms2.php");
- $cur_time=date( "Y-m-d H:i:s ", time( ) );
- $query = "SELECT * from SMS2 where `SEND_TIME`<='{$cur_time}' and `SEND_FLAG`!='1'";
- $cursor = exequery( TD::conn( ), $query );
- while ( $ROW = mysql_fetch_array( $cursor ) ){
- $Send_USER_ID=$ROW['FROM_ID'];
- $SEND_TIME = $ROW['SEND_TIME'];
- $PHONE = $ROW['PHONE'];
- $CONTENT = $ROW['CONTENT'];
- $SMS_ID=$ROW['SMS_ID'];
- send_mobile_sms($cur_time,$Send_USER_ID,$PHONE, $CONTENT);
- /*不管发送成功于否,删除原记录,新的会生成*/
- $query1="delete from SMS2 where `SMS_ID`='{$SMS_ID}'";
- exequery( TD::conn( ), $query1);
- }
- echo "+OK";
- ?>
复制代码 把下面的代码 存储为一个文件,比如:germ_send_sms.php,放置于webroot\task目录下,再打开数据Office_Task数据表新建一个 TASK_TYPE为0的定时任务(即按分钟执行)别的执行时间什么的,自己设置! 也可直接执行下面的SQL
- INSERT INTO OFFICE_TASK(TASK_TYPE,`INTERVAL`,EXEC_TIME,LAST_EXEC,TASK_URL,TASK_NAME,TASK_DESC,TASK_CODE,USE_FLAG,SYS_TASK) VALUES ('0','5','10:08:08','2012-03-02','/task/germ_send_sms.php','定时发送手机短信','定时发送的短信','germ_send_sms','1','1'
复制代码
|
|