페이지

2012년 8월 19일 일요일

php test

<?
    $br = "<br>";
?>

<?
    $file = "fopen_test.txt";
    if(file_exists($file)==false){
        echo "file not found:".$file;
        return;
    }
   
    $fp = fopen($file,r);
    if(!$fp){
        echo "failed to open";
       
    } else {
        $contents = fread($fp,filesize($file));
        echo $contents;
    }
    fclose($fp);
    echo $br;
    echo "read ok";



   
    $fp = fopen($file,a);
    if(!$fp){
        echo "failed to open";
    }else {
        $str = "append string ok추가";
        fwrite($fp,$str.$br);
        fclose($fp);
    }
    echo $br."ok! insert";   
   
?>

댓글 없음:

댓글 쓰기