6. 可以直接php,不过文件里面的路径要用绝对路径
8. <?php
ini_set("max_execution_time","500");
date_default_timezone_set("PRC");
$time=date("H",time());
if(($time>5)&&($time<20)){
if(!file_exists('jy.txt')){
$result=file_get_contents('
http://www.kgda.tk/fx/cl.php');
echo $result;
if(preg_match('/发送成功/',$result))
file_put_contents('jy.txt',$result);
}
if(!file_exists('jy2.txt')){
$result=file_get_contents('
http://www.kgda.tk/fx/tq.php');
if(preg_match('/发送成功/',$result))
file_put_contents('jy2.txt',$result);
}
}
else if($time>=20){
if(file_exists('jy.txt')){
unlink('jy.txt');
}
if(file_exists('jy2.txt')){
unlink('jy2.txt');
}
}
?>
可是file_get_contents也不执行。。
@无-名
顺便问下,绝对路径怎么写
9. 我的挂Q就是用控制面板里面的cron job监控的
11. 比如把jy.txt写成/home/..../public_html/jy.txt
15.
@无-名 这个五分钟执行一次对不对*/5 * * * * php -f /home/u540858235/public_html/fx/ds.php
16. ds.php
<?php
ini_set("max_execution_time","500");
date_default_timezone_set("PRC");
$time=date("H",time());
if(($time>5)&&($time<20)){
if(!file_exists('/home/u540858235/public_html/fx/jy.txt')){
$result=file_get_contents('
http://www.kgda.tk/fx/cl.php');
echo $result;
if(preg_match('/发送成功/',$result))
file_put_contents('/home/u540858235/public_html/fx/jy.txt',$result);
}
if(!file_exists('jy2.txt')){
$result=file_get_contents('
http://www.kgda.tk/fx/tq.php');
if(preg_match('/发送成功/',$result))
file_put_contents('/home/u540858235/public_html/fx/jy2.txt',$result);
}
}
else if($time>=20){
if(file_exists('/home/u540858235/public_html/fx/jy.txt')){
unlink('/home/u540858235/public_html/fx/jy.txt');
}
if(file_exists('/home/u540858235/public_html/fx/jy2.txt')){
unlink('/home/u540858235/public_html/fx/jy2.txt');
}
}
?>