how remove the backslash (“\”) in the json response using php?

前端 未结 5 702
伪装坚强ぢ
伪装坚强ぢ 2020-12-30 12:07

I try to add a row of mysql query into JSON whit php. I use this code:

public function lugaresCercanos($lng, $lat, $distance){
$result=mysql_query(\"SELECT n         


        
5条回答
  •  囚心锁ツ
    2020-12-30 13:07

    If anyone wants to remove the backslashes and also pretty print the JSON data, the following can be used:

    json_encode($my_array, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
    

提交回复
热议问题