我有一個字符串,因爲'& q'(我猜)被原始字符串轉義而過早終止。如果我想在PHP中保留原始字符串,應該如何處理這個問題?JSON轉義字符
原始字符串
'http://answers.onstartups.com/search?tab=active&q=fbi'
的var_dump結果
'["http://answers.onstartups.com/search?tab=active'
JS
var linksStr = $("#links").val();
var matches = JSON.stringify(linksStr.match(/\bhttps?:\/\/[^\s]+/gi));
$.ajax({
type: 'GET',
dataType: 'json',
cache: false,
data: 'matches=' + matches,
url: 'publishlinks/check_links',
success:
function(response) {
alert(response);
}
})
check_links
$urls = $this->input->get('matches');
var_dump($urls);
轉發不讚賞。 http://stackoverflow.com/questions/7044409/json-escaped-character – mario