Maison >développement back-end >tutoriel php >PHP向txt文件里面写入字符串,换行有关问题
PHP向txt文件里面写入字符串,换行问题
<br />$DOCUMENTROOT = $_SERVER['DOCUMENT_ROOT'];<br /> $file = fopen("$DOCUMENTROOT/php_02/123.txt","wb");<br /> fwrite($file,"line 1 "."\n"." line 2 n line 3");<br /> fclose($file);<br />
<br />$DOCUMENTROOT = $_SERVER['DOCUMENT_ROOT'];<br /> $file = fopen("$DOCUMENTROOT/php_02/123.txt","wb");<br /> fwrite($file,"line 1 "."\r\n"." line 2 n line 3");<br /> fclose($file);<br />