json_encode(), json_decode()
- ๋ฅ์ง
- Development
- ๋ถ๋ฅ
- PHP
- ๋ฑ๋ก์ผ
json_decode()๋ฅผ ์ฌ์ฉํ ๋ ๋ฆฌํด๊ฐ์ด null๋ก ๋์ค๋๊ฒฝ์ฐ
"๊ฐ \"๋ก ๋์ด์์๋ decode๊ฐ ๋์ง์๋ ํ์์ด ๋ฐ๊ฒฌ๋์๋ค. ์ด์ ๋ํด์ ํด๊ฒฐ๋ฐฉ๋ฒ์ ์๋ ์์ค์ ๊ฐ๋ค.
if(get_magic_quotes_gpc())
{
$result = stripslashes($_POST['result']);
}
else
{
$result = $_POST['result'];
}
$json = json_decode($result, true);
์ฐธ๊ณ URL
http://www.evanconkle.com/2011/11/json_decode-returns-null-php/
json_encode๋ฅผ ์ฌ์ฉํ ๋ ํ๊ธ์ด \ud55c\ud6a8\uc8fc ๊ฐ์ด ์ถ๋ ฅ๋ ๋..
๋ค์๊ณผ ๊ฐ์ด ์ฌ์ฉํ๋ฉด ํด๊ฒฐ๋จ.
echo json_encode($result, JSON_UNESCAPED_UNICODE);
0๊ฐ์ ๋๊ธ
๋ฑ๋ก๋ ๋๊ธ์ด ์์ต๋๋ค.