我的程序放在D盘,要向C盘的a.txt写入数据,请问怎么操作?if (!file_exists('c://a.txt')) {  
$fp = fopen('c://a.txt','ab'); 
$col ="hhh"; //记录赋值 
fwrite($fp, $col); 
fclose($fp); //关闭文件 
}

解决方案 »

  1.   

    if (!file_exists('c://a.txt')) 

        fopen('c://a.txt','a');
    }
    $fp = fopen('c://a.txt','a'); 
    $col ="hhh"; //记录赋值
    fwrite( $fp, $col );
    fclose($fp); //关闭文件
      

  2.   

    if (!file_exists('c://a.txt')) 

        fopen('c://a.txt','a');
    }
    $fp = fopen('c://a.txt','a'); 
    $col ="hhh"; //记录赋值
    fwrite( $fp, $col );
    fclose($fp); //关闭文件//多了个 }