htmlentities 和 json_encode,如果使用转义数据的 json_encode,我是否需要使用 htmlentities?
这够了吗 - json_encode 转义数据
echo json_encode( $items );
或者这样做使用 htmlentities 来转义数据:
foreach ( $data as $d ) {
$items[] = htmlentities( $d );
}
echo json_encode( $items );
客户端:JQuery ajax:
$('#textbox').attr( 'value', variable );