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

前端 未结 5 748
伪装坚强ぢ
伪装坚强ぢ 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:40

    The \ is to escape the quotes (") that are part of the response.

    Use stripslashes() to strip these out.

    When a string wrapped in quotes contains quotes, they have to be escaped. The escape character in php is \.

提交回复
热议问题