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

前端 未结 5 704
伪装坚强ぢ
伪装坚强ぢ 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 12:50

    Try

    json_encode($arr, JSON_UNESCAPED_SLASHES);
    

    or

    echo str_replace('\/','/',json_encode($mydatas));
    

    (if unescape doesn't work) http://php.net/manual/en/function.json-encode.php

提交回复
热议问题