我写了一个简单的PHP脚本,每秒调用一次,上传GPS设备的纬度和经度。
在随机调用次数(从20到30)后,脚本停止工作。但过了一段时间它再次起作用了!
有人能帮助我吗?我怀疑在代码中这是一个非常微不足道的错误......
谢谢!
路易
<?php
function SaveLogMsg($msg){
if(!empty($msg))
{$fp = fopen("@Log.txt","a+");
if($fp)
{
fwrite($fp, $msg."\r\n");
fclose($fp);
}
}
}
//== GET section ============================
if (!empty($_GET))
{
if ($_GET['cmd']=="alive3")
{
include ("welcome3.html");
exit(0);
}
}
//== POST section ===========================
if (!empty($_POST))
{
if (isset($_POST['cmd']))
{
// write lat and long from $SESSION in data base
SaveLogMsg(sprintf("cmd: %s",$_POST['cmd']));
}
}
exit(0);
?>