답변 1개
채택된 답변
+20 포인트
7년 전
※ 참고사항 : http://php.net/manual/kr/function.json-encode.php
php 5.4이상
</p>
<p>$array = array("foo","bar");</p>
<p>$result = json_encode($array,JSON_UNESCAPED_UNICODE);</p>
<p>
php 5.3이하
</p>
<p>function my_json_encode($arr)
{
//convmap since 0x80 char codes so it takes all multibyte codes (above ASCII 127). So such characters are being "hidden" from normal json_encoding
array_walk_recursive($arr, function (&$item, $key) { if (is_string($item)) $item = mb_encode_numericentity($item, array (0x80, 0xffff, 0, 0xffff), 'UTF-8'); });
return mb_decode_numericentity(json_encode($arr), array (0x80, 0xffff, 0, 0xffff), 'UTF-8');
}
$array = array("foo","bar");
$result = my_json_encode($array);</p>
<p>
로그인 후 평가할 수 있습니다
답변에 대한 댓글 1개
�
더블피디
7년 전
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
JSON_UNESCAPED_UNICODE 설정을 해야하는군요