1
htmlentities和json_encode,如果使用轉義數據的json_encode,我需要使用htmlentities嗎?htmlentities和json_encode,如果使用json_encode轉義數據,我需要使用htmlentities嗎?
這是不夠的 - json_encode逃脫數據
echo json_encode($items);
或爲此使用ヶ輛逃跑數據:
foreach ($data as $d) {
$items[] = htmlentities($d);
}
echo json_encode($items);
客戶端:JQuery的AJAX:
$('#textbox').attr('value', variable);
爲什麼不使用抽象出這些問題的框架呢? Symfony是一個體面的:http://symfony.com/ – 2013-02-22 18:43:27
[偉大的逃避現實(或:你需要知道如何處理文本內的文本)](http://kunststube.net/escapism/) – deceze 2013-02-22 18:43:52
我打算在未來使用和學習框架,但首先我需要學習PHP足夠好。 – 2013-02-22 18:47:07