发布json_encode数据时请求的JSON解析失败,我怎么能复活“\”

$valueArr=htmlspecialchars(json_encode($event), ENT_QUOTES, 'UTF-8'); 

我发送json_encode($valueArr)

 <a href="javascript:void(0)" id="event_event_id?>" onclick='getDetailsEvent()' > 

这个function

   function getDetailsEvent(eObj){ var edStr=JSON.stringify(eObj); m.ajax({ type: "POST", url: "/socialuser/event_calender/gethtml.php", data: "ed="+edStr+"&t=", contentType: 'application/json; charset=utf-8', dataType: "json", error: function(jqXHR, exception){ if (jqXHR.status === 0){ alert('Not connect.\n Verify Network.'); }else if (jqXHR.status == 404){ alert('Requested page not found. [404]'); }else if (jqXHR.status == 500){ alert('Internal Server Error [500].'); }else if (exception === 'parsererror'){ alert('Requested JSON parse failed.'); }else if (exception === 'timeout'){ alert('Time out error.'); }else if (exception === 'abort'){ alert('Ajax request aborted.'); }else{ alert('Uncaught Error.\n' + jqXHR.responseText); } }, beforeSend:function(){ var bSend = 'loading . . . '; m('#load').show(); m('#load').html(bSend); }, success: function(response){ m('#evenDetails').html(response); } }); }  

现在,在这个function上,每一件事都可以工作,如果我没有在我的本地服务器上使用“datatype:”json“”,但在服务器上这不起作用..

它会给出错误

 else if (exception === 'parsererror'){ alert('Requested JSON parse failed.'); 

在ajax电话..

在post页面上打印发布数据时,数据如下所示

 {\"first_name\":\"Pradeep\",\"last_name\":\"Kumar\",\"profile_image\":\"thumbnail_10000022_1359466283.jpg\",\"category\":\"Restaurant\",\"category_image\":\"icon_restaurants.png\",\"category_icons\":\"restaurants_icon.png\",\"event_id\":\"17\",\"social_users_id\":\"10000022\",\"location\":\"new, Thandla, Madhya Pradesh 457777, India\",\"lat\":\"23.0048561\",\"lng\":\"74.57584440000005\",\"title\":\"dasdasd\",\"event\":\"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop p\",\"pic_event\":\"517a1d4a38d411366957386.jpg\",\"event_type\":\"1\",\"day\":\"15\",\"month\":\"5\",\"year\":\"2013\",\"date\":\"1368556200\",\"time\":\"0\"} 

我的问题是,如果我得到这种类型的数据,我怎么能json_decode,因为它包含“\”,它不会解析服务器上的数据。

htmlspecialchars函数添加特殊字符以避免安全漏洞,其中一个字符是’/’字符。 我建议只使用json_encode($event)