文件.txt[sdf]asdf=offfdsa=50 [dsa]qwe=0ewq=30s//-----------------------------------------我想將qwe=0 修改為 qwe=1考慮到千行的問題,不重寫 如何才能做到?
1 回答

弒天下
TA貢獻1818條經驗 獲得超8個贊
<?php
$origin_str = file_get_contents('路徑/文件.txt');
$update_str = str_replace('qwe=0', 'qwe=1', $orgin_str);
file_put_contents('路徑/文件.txt', $update_str);
?>
- 1 回答
- 0 關注
- 4139 瀏覽
添加回答
舉報
0/150
提交
取消