Escaping JSON apostrophe before PHP's json_encode truncates?

前端 未结 2 1548
后悔当初
后悔当初 2021-01-05 16:21

I have a field in a MySQL database (utf8_general_ci) that contains a curly (smart?) apostrophe: Owner’s...

This prints fine with no special handling if

2条回答
  •  感动是毒
    2021-01-05 17:02

    For details: json_encode

    Example:

    echo json_encode($array, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
    

提交回复
热议问题