我觉得这个函数比较方便,如果每次都是覆写文件的话
file_put_contents('文件名','要写的内容')

解决方案 »

  1.   

    you can try this funcionfuncion fengmaniuBuxiangji($file)
    {
    $hd=fopen($file,"w") or die("gameover");
    fputs($hd,"1.我是中国人\n"."2.我们爱自己的祖国\n");
    fclose($hd);
    return true;
    }
      

  2.   

    换行用\n表示
    $content="1.我是中国人\n2.我们爱自己的祖国";
    $filePath='./test.txt';
    file_put_contents($filePath,$content);
      

  3.   

    LZ根本没说清楚想干什么 要是仅仅是说的这样 写模式打开到文件开始部位 写就OK了 何来改写