Before
{
"DB_USERNAME": "root",
"DB_PASSWORD": "12ko31ko2k3fef",
"ROBOTS": "noindex, nofollow"
}
// filePut.php
<?php
// 這邊就看你要怎接前端給的資料了,用Get或Post之類的
$newData = [
"DB_USERNAME" => "root",
"DB_PASSWORD" => "1234",
"ROBOTS" => "noindex, nofollow"
] ;
file_put_contents('xxx.json', json_encode($newData)) ;
After
{
"DB_USERNAME": "root",
"DB_PASSWORD": "1234",
"ROBOTS": "noindex, nofollow"
}