• ÇÁ¸®Ä«¿îÅÍ
  • Ç÷¡½ÃºÏ
  • ÇÁ¸®º¸µå
  • Àü±¤ÆÇ
  • À¥°øºÎ¹æ
  • Ä¿¹Â´ÏƼ
[php] PHP ¿¡¼­ JSON »ç¿ëÇϱâ 2009.09.25 04:03
±Û¾´ÀÌ : ¿î¿µÀÚ Á¶È¸ : 342 Ãßõ : 0

JSONÀº..? ¾Æ·¡ »çÀÌÆ®¸¦ Âü°íÇϱ⠹ٶõ´Ù.

http://www.json.org/json-ko.html

ÀÏ´Ü (PHP 5 >= 5.2.0, PECL json:1.2.0-1.2.1) 5.2.0ÀÌ»ó ¹öÀü¿¡¼­´Â ³»ÀåµÇ¾î Àִµí ÇÏ´Ù..

À̹öÀü º¸´Ù ¾Æ·¡ÀÇ °æ¿ì STEP1ÀÇ ÀýÂ÷¸¦ °ÅÄ¡µµ·Ï ÇÑ´Ù

STEP1
shell> wget http://www.aurore.net/projects/php-json/php-json-ext-1.2.1.tar.bz2
shell> bzip2 -d php-json-ext-1.2.1.tar.bz2
shell> tar xvf php-json-ext-1.2.1.tar
shell> cd php-json-ext-1.2.1

shell> ./configure --with-php-config=[php-configÀ§Ä¡]
shell> make
shell> make install

STEP2
<?php
$val = array(urlencode("¿¡Çô~"), "1", 23);
$output = json_encode($val);
echo urldecode($output)."\n";
?>

°á°ú
["¿¡Çô~","1",23]


json ÇÔ¼ö´Â EUC-KRÀ» Áö¿øÇÏÁö ¾Ê´Â´Ù. ( This function only works with UTF-8 encoded data.  )

±×·¡¼­ iconv¸¦ »ç¿ëÇÒ±î ÇßÁö¸¸ ÇѱÛÀÌ ±úÁ® º¸ÀÌ´Â Çö»óÀÌ ÀÖ¾î

urlencode¿Í urldecode¸¦ »ç¿ëÇß´Ù

ÀλýÀº ª½À´Ï´Ù.
±×·¯¹Ç·Î ´Ù¸¥ »ç¶÷ÀÌ ¿ä±¸ÇÏ´Â »îÀ» »ì¸é¼­ ½Ã°£À» ³¶ºñÇؼ­´Â ¾È µË´Ï´Ù.
µ·°ú ¸í¿¹¸¦ ¾òÁö ¸øÇÏ´õ¶óµµ ³¡±îÁö ÀÚ½ÅÀÇ ±æÀ» °íÁýÇϽʽÿÀ
¸ñ·Ï À­±Û ¾Æ·§±Û
³»¾Ë FREECOUNT.NET ÇÁÄ«³Ý »ý±ä³¯ 2003.12.20 Ȩ | Ä«¿îÅÍ | Ç÷¡½ÃºÏ | ÇÁ¸®º¸µå | Àü±¤ÆÇ | À¥°øºÎ¹æ | Ä¿¹Â´ÏƼ | ÂÊÁöÇÔ