常用的php文件处理函数
下面是几个常用的php文件处理函数,在处理文件,或者不使用数据库的时候特别好用,学好下面的函数,大家也可以制作php安装程序了,基本完成对php文件,其他配置文件的php程序修改了.
1.touch
设置文件的访问和修饰时间
bool touch(string $filename[, int $time[, int $time]])
2.copy
复制文件
bool copy(string $source, string $dest)
注意:移动文件请使用rename函数
3.file_put_contents
将一个字符串写入文件
int file_put_contents(string $filename, string $data[, int $flag[, resource $content]])
4.file_get_contents
将整个文件读到字符串
string file_get_contents(string $filename[, bool user_include_path [, resource $content[, int $offset[, int $maxlen]]]])
在写入前先读取出来进行处理,整理好要写入的数据后,拼接后写入,便是文本数据库的原理了
来自ipvb学习网