您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

PHP 写入 txt 文件,换行符怎么弄?

2024/3/31 20:59:20发布11次查看
$filename=r:/info.txt;$str = date(y-m-d h:i:s,time()) .' '.$strarr ./r/n;fwrite($file, $str);

我这样写,结果 换行符 是实体,也就是/r/n,怎么回事呢?
回复内容: $filename=r:/info.txt;$str = date(y-m-d h:i:s,time()) .' '.$strarr ./r/n;fwrite($file, $str);

我这样写,结果 换行符 是实体,也就是/r/n,怎么回事呢?
把/r/n换成\r\n
用php_eol,
http://php.net/manual/zh/reserved.constants.php
斜杠的方向弄反了 应该是rn
两种方法:
1.$str = date(y-m-d h:i:s,time()) .' '.$strarr .rn;
2.$str = date(y-m-d h:i:s,time()) .' '.$strarr .php_eol;
unixlinux n
mac os r
windows rn
跨平台 php_eol
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product