bootstrap手机页面

来源:互联网 发布:c语言for break 编辑:程序博客网 时间:2024/05/18 18:01
 <?php
ignore_user_abort();//关掉浏览器,PHP脚本也可以继续执行.
set_time_limit(0);// 通过set_time_limit(0)可以让程序无限制的执行下去
$interval=30;// 每隔半小时运行
$i = 1;
do{
    //这里是你要执行的代码
    header("Content-type: text/html; charset=utf-8");
    $url = 'http://localhost/cfyj/dean.php?s=Synchrodata/index';
    $ch = curl_init();//初始化curl
    curl_setopt($ch, CURLOPT_URL,$url);//抓取指定网页      
    curl_setopt($ch, CURLOPT_HEADER, 0);//设置header
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//要求结果为字符串且输出到屏幕上
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    $data = curl_exec($ch);//运行curl
    curl_close($ch);
    if(!file_exists('action_time.txt')) break;
    $file = "action_time.txt";
    $content = "这是第".$i."次执行!/r/n";
    $fp = fopen($file, "a+");
    fwrite($fp,$content);
    fclose($fp);
    $i++;
    sleep($interval);// 等待10分钟
}while(true);
?>