Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

json + js + php ¼òµ¥½»»¥

×î½üÔÚдһ¸ö ǰ̨»ùÓÚ javascript. µÄ¿Í»§¶Ë ·þÎñÆ÷¶ËPHP µÄ·ÖÎöϵͳ¡£
Ô­Ïȼƻ®Ê¹ÓÃXMLΪÊý¾Ý½»»¥»ù´¡ µ«ÊÇ×îÖÕ»¹ÊÇÑ¡ÓýÏÇáÁ¿¼¶µÄJSON×îΪÊý¾Ý½»»¥»ù´¡¡£
Ê×ÏȽéÉÜjsonµÄ¸ñʽ
json ˵¼òµ¥ÆäʵÊÇÒ»ÖÖÊý¾Ý¸ñʽ  ¸ü¼òµ¥µÄ¿ÉÒÔ¿´×ö¼òµ¥µÄÊý×é¡£
ʵÀý £¨Ò»£©
<script>
  var jsonArray=[
                 {"house":["±ðÊû","ÉÌÆ··¿","ƽ·¿"]}
                ,{"place":["±±¾©\","¸£½¨","ºÓÄÏ"]}
       ];
  jsonArray=eval(jsonArray);
   alert(jsonArray[0].house[1]);
</script>
ʵÀý(¶þ)
PHP¶ËÉú³Éjson¸ñʽµÄÊý¾Ý
PHPÌṩÁËÁ½¸öjsonÏà¹ØµÄº¯Êý 
json_encode :²úÉújson¸ñʽÊý¾Ý
json_decode £º½âÂëjson¸ñʽÊý¾Ý ±äΪÆÕͨÊý×é
<?
$array=array(
                'house'=>array('±ðÊû','ÉÌÆ··¿','ƽ·¿'),
        "place"=>array('±±¾©','¸£½¨','ºÓÄÏ')
      );
/*
  Éú³Éjson¸ñʽ
*/
$json = json_encode($array);
echo $json;
/*
  ½âÂëjson¸ñʽ
*/
$decode_json=json_decode($json);
var_dump($decode_json);
?>
 
ת×Ô£ºhttp://163navy.blog.163.com/blog/static/105304086200982595643132/


Ïà¹ØÎĵµ£º

phpÖеÄevalºÍJavaScriptÖеÄeval

phpÖеÄevalºÍJavaScriptÖеÄevalÇø±ð£º
Definition and Usage

¶¨ÒåºÍÓ÷¨
The eval() function evaluates a
string as PHP code.
eval()º¯ÊýµÄ×÷ÓÃÊÇ£º·µ»ØÓëPHP´úÂëÏà¶ÔÓ¦µÄ×Ö·û´®¡£
The string
must be valid PHP code and must end with semicolon.
Õâ¸ö×Ö·û´®±ØÐëÊÇÓÐЧµÄPHP´úÂ룬
²¢ÇÒ±ØÐëÒԷֺŽáÊø¡ ......

PHP ÕýÔò±í´ïʽ×ÊÁÏ


¡¡Ã¿¸öPHP³ÌÐòÔ±¶¼ÖªµÀPHPÓÐÇ¿´óµÄÕýÔò±í´ïʽ¹¦ÄÜ£¬ÎªÁËÒÔºóµÄ¹¤×÷·½±ã£¬ÎÒ´ÓÍøÉÏÕûÀíÁ˹ØÓÚÕýÔò±í´ïʽµÄ×ÊÁÏ£¬·½±ãÒÔºó¹¤×÷ʱµÄ½øÐÐ×ÊÁϲéÔÄ¡£ 
¡¡¡¡ÕýÔò±í´ïʽ(regular expression)ÃèÊöÁËÒ»ÖÖ×Ö·û´®Æ¥ÅäµÄģʽ£¬¿ÉÒÔÓÃÀ´¼ì²éÒ»¸ö´®ÊÇ·ñº¬ÓÐijÖÖ×Ó´®¡¢½«Æ¥ÅäµÄ×Ó´®×öÌæ»»»òÕß´Óij¸ö´®ÖÐÈ¡³ö·ûºÏij¸öÌõ¼þµÄ×Ó´®µÈ¡£ ......

PHPÀàµÄ×Ô¶¯¼ÓÔØ

ͨ³£ÎÒÃÇдһ¸öÀàÈçÏ£º
a.php
class A
{
public function __construct()
{
echo "hello world!";
}

page.php
require("a.php");
$a = new A(); 
ÎÒÃÇÊÇͨ¹ýÊÖ¹¤ÒýÓÃij¸öÀàµÄÎļþÀ´ÊµÏÖº¯Êý»òÕßÀàµÄ¼ÓÔØ
µ«Êǵ±ÏµÍ³±È½ÏÅÓ´ó£¬ÒÔ¼°ÕâЩÀàµÄÎļþºÜ¶àµÄʱºò£¬ÕâÖÖ·½Ê½¾ÍÏԵ÷dz ......

ÓÃPHPʵÏÖÒ»¸öË«Ïò¶ÓÁÐ

<?php
class DoubleQueue
{
public $queue = array();
/**£¨Î²²¿£©Èë¶Ó **/
public function push($value)
{
return array_push($this->queue,$value);
}
/**£¨Î²²¿£©³ö¶Ó**/
public function pop()
{
return array_pop($this->queu ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ