反转PHP文件()函数

Mic*_*ele 3 php arrays newline file

我使用file()函数将.php文件转换为数组.
现在我修改了数组,我想将所有内容放回文件中(保持行结尾)...
有人可以告诉我是否有一个与file()相反的函数?
我想绕过恼人的"数组到字符串转换"的方式......

提前致谢!

TiM*_*TER 12

使用file_put_contents()implode():

file_put_contents('/your/file.php', implode(PHP_EOL, $fileArray));
Run Code Online (Sandbox Code Playgroud)