遇到一问题,请各位帮忙。。谢谢!
请问:PHP如何按格式将内容写入txt
如:输出类型与格式
打开txt时按这种格式显示
a|b|c|d谢谢!

解决方案 »

  1.   

    设一个变量$a用"a|b|c|d"的格式。
    再fwrite()写入文件
      

  2.   

    file_put_contents('a.txt', 'a|b|c|d');
      

  3.   

    fopen   fwirte("test.txt","content")
      

  4.   

    格式是自己定义的。php负责安装你定义的格式去写。
      

  5.   

    $str="1";
    $str.="|2";
    $str.="|3";file_put_contents('a.txt', $str);///============
    $str[]="a";
    $str[]="b";
    $str[]="c";
    $str[]="d";file_put_contents('a.txt', join(",",$str));