我使用encodeURIComponent通过Ajax发送一些消息,但在服务器端,我在消息中收到了一些不需要的字符,而不是
can't
我明白了
can\'t
这个问题的解决办法是什么
最佳答案
试试这个答案:
<?php
// first use encodeURIComponent on javascript to encode the string
// receive json string and prepare it to json_decode
$jsonStr = stripslashes ($_POST['action']);
// decode to php object
$json = json_decode ($jsonStr);
// $json is now a php object
?>
来自:
关于php - Ajax获取消息问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5914388/