1. 程式人生 > >php 對象轉字符串

php 對象轉字符串

force object ring str highlight div sha light for

$json_string = json_encode($object, JSON_FORCE_OBJECT);



json_encode($object);

//結果:"[{"aa":"bb","cc":"dd"}]"

json_encode($object,JSON_FORCE_OBJECT);

//結果:"{"aa":"bb","cc":"dd"}"

  

php 對象轉字符串