Home  >  Article  >  Backend Development  >  浅析php fwrite写入txt文件的时候用 rn不能换行的问题_php技巧

浅析php fwrite写入txt文件的时候用 rn不能换行的问题_php技巧

WBOY
WBOYOriginal
2016-05-17 08:56:191006browse

今天遇到了一个问题就是用fwrite写入txt文件的时候用 rn不能换行
试了很久都没找到办法!
突然之间想到一个东东以前看书见过后来还是用这个东东给解决了!
现在写出来预防将来忘记也希望能帮到需要帮助的朋友!
直接看代码:

复制代码 代码如下:

$stream = fopen("robots.txt", "w+");
fwrite($stream, "你换行了吗 \n我已经换行了!");
?>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn