久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      php如何修改json數(shù)據(jù)格式

      方法:首先用“json_decode(字符串,true)”語句將JSON格式轉(zhuǎn)換成數(shù)組格式;然后用“數(shù)組[元素]="值"”語句來修改數(shù)據(jù);最后用“json_encode(數(shù)組)”語句將修改后的數(shù)組轉(zhuǎn)換成json格式即可。

      php如何修改json數(shù)據(jù)格式

      本教程操作環(huán)境:windows7系統(tǒng)、PHP7.1版,DELL G3電腦

      // 追加寫入用戶名下文件 $code="001";//動態(tài)數(shù)據(jù)         $json_string = file_get_contents("text.json");// 從文件中讀取數(shù)據(jù)到PHP變量         $data = json_decode($json_string,true);// 把JSON字符串轉(zhuǎn)成PHP數(shù)組         $data[$code]=array("a"=>"as","b"=>"bs","c"=>"cs");         $json_strings = json_encode($data);         file_put_contents("text.json",$json_strings);//寫入 //修改     $json_string = file_get_contents("text.json");// 從文件中讀取數(shù)據(jù)到PHP變量     $data = json_decode($json_string,true);// 把JSON字符串轉(zhuǎn)成PHP數(shù)組     $data["001"]["a"]="aas";     $json_strings = json_encode($data);     file_put_contents("text.json",$json_strings);//寫入

      推薦:《2021年P(guān)HP面試題大匯總(收藏)》《php視頻教程

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號