gpt4 book ai didi

php - 反转 PHP file() 函数

转载 作者:可可西里 更新时间:2023-11-01 00:00:24 26 4
gpt4 key购买 nike

我使用 file() 函数将 .php 文件转换为数组。
现在我修改了数组,我想将它的所有内容放回文件(保留行尾)...
谁能告诉我有没有和file()相反的函数?
我想绕过烦人的“数组到字符串转换”方式...

提前致谢!

最佳答案

使用file_put_contents()implode() :

file_put_contents('/your/file.php', implode(PHP_EOL, $fileArray));

关于php - 反转 PHP file() 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20421366/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com