【发布时间】:2013-08-20 04:32:25
【问题描述】:
使用 Codeigniter 函数write_file(),我可以像这样写入现有文件:
write_file("path_to_file", "String four"."\n", "a+");
假设我已经有一个这样的文件:
String one
String two
String three
使用 write_file("path_to_file", "String four"."\n", "a+") ,我在第一次写入文件时有以下输出:
String one
String two
String three String four
知道如何第一次将 String 4 写入换行符吗?如下图:
String one
String two
String three
String four
谢谢。
【问题讨论】:
-
可以先检查文件是否为空;如果是,只需写下该行。如果不是,请附加一个新行和您的内容。
标签: php codeigniter