这样试试:
$filename = "http://localhost/game/a.rar";
$filesize=filesize($filename);
if($filesize!=0){
echo "ok";
}else{
echo "no";
}

解决方案 »

  1.   

    <?php
    $filename = "./install.php";
    if (is_file($filename)) {
    echo "ok";
    }else {
    echo "no";
    }?>俺试了这样可以,可能是不可以检测远程文件吧。想检测远程文件是否存在,可以这样:
    <?php
    $filename = "http://www.sina.com.cn";
    if (@file($filename)) {
    echo "ok";
    }else {
    echo "no";
    }?>
      

  2.   

    楼主那里写错了,应该是:is_file($filename)