PHPºÍJavascriptµÄJSON½»»¥£¨´¦ÀíÒ»¸ö¶þάÊý×飩
PHPµÄJSONÀà¿âÎÒʹÓõÄÊÇServices_JSON
£¬Ã»Ê²Ã´ÌرðµÄÓŵ㣬ҲûʲôÃ÷ÏÔµÄȱµã£¬¶Ô¸¶ÓÃ×ãÒÓ¡£
½¨Á¢Îļþdata.php
£º
<?php
include(
"JSON.php"
);
$data
= array(
array(
'name'
=>
mb_convert_encoding
(
'ÀÏÍõ'
,
'UTF-8'
,
'GBK'
),
'age'
=>
'28'
),
array(
'name'
=>
mb_convert_encoding
(
'С»Æ'
,
'UTF-8'
,
'GBK'
),
'age'
=>
'27'
)
);
$json
= new
Services_JSON
();
echo
$json
->
encode
(
$data
)
;
?>
Javascript½âÎöJSONÎÒʹÓõÄÊÇJquery
£¬Ö±½ÓʹÓÃJavascriptµÄevalÔòÓиöµØ·½Òª×¢Ò⣺
var myObject = eval('(' + myJSONtext + ')');
¾ßÌå¿É²é¿´ÏÂÃæµÄ²Î¿¼Á´½Ó¡£
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>demo</title>
<script type="text/javascript" src="jquery-latest.pack.js"></script>
<script>
$(function(){
$.getJSON("data.php
", function(json){
for(var i = 0; i < json.length; i++)
{
alert("ÐÕÃû£º" + json[i].name);
alert("ÄêÁ䣺" + json[i].age);
}
});
});
</script>
</head>
<body>
</body>
</html>
²Î¿¼×ÊÁÏ£ºhttp://www.json.org/js.html
Ïà¹ØÎĵµ£º
±¾ÎÄÀ´×Ô£ºhttp://forum.sysmu.com/thread-394-1-1.html
ÍøͨÏß·,²¿·ÖÎļþÏÂÔرȽÏÂý,ÍûÁ½â! 7 P+ q$ K. }0 ^$ l1 b
µÚÒ»²¿·Ö: htmlÓïÑÔ»ù´¡
ftp://edu:edu@ftp.hyperedu.cn:2003/ÊÓƵ½Ìѧ1Çø/JavaScriptÕÅТÏé/01-01.rmvb
fftp://edu:edu@ftp.hyperedu.cn:2003/ÊÓƵ½Ìѧ1Çø/JavaScriptÕÅТÏé/01-02.rm ......
1. oncontextmenu="window.event.returnValue=false" ½«³¹µ×ÆÁ±ÎÊó±êÓÒ¼ü
<table border oncontextmenu=return(false)> <td>no </table> ¿ÉÓÃÓÚTable
2. <body onselectstart="return false"> È¡ÏûÑ¡È¡¡¢·ÀÖ¹¸´ÖÆ
3. onpaste="return false&quo ......
¼ÌÐøÉÏÒ»²¿·Ö£¬ÏÖÔÚÎÒÃǵÄʵµÄ¹¹ÔìÆ÷initializeºÜÍêÃÀÁË£¬ÉõÖÁÁ¬ÀàʽsuperÕâÑùÓï·¨ÌǶ¼²»ÓÃÁË£¬¾Í×Ô¶¯ÊµÀýÁ˸¸Àà¡£ÎÒÃÇת¶ø¿´Ò»¿´ÆäÊôÐÔÓë·½·¨µÄ¼Ì³Ð¡£Ðí¶àÀà¿â¶¼ÊÇÒ»¸öfor...inÑ»·ÔÙ¼ÓһЩÅж¨ÊµÏÖÔÐÍÊôÐÔ¿½±´£¬»ò¸ù¾ÝÕâЩÅж¨°ÑijЩÊôÐÔ¾¾³öÀ´¼Ó¹¤Ò»ÏÂÔٷŽøÈ¥¡£ÓÖÈ磬ÎÒÃÇÒª¶ÔArrayµÄÄ£°å½øÐÐÀ©Õ¹£¬×ö³ÉÒ»¸öÐÂÀàArray2 ......
×î½üÎҵļ¸ÆªÎÄÕ¶¼ÊÇÊÇ×î½üÏîÄ¿µÄÒ»µãÐĵÃ^^
Õâ¸öÏîÄ¿Ò»¿ªÊ¼¾ÍÉè¼ÆµÄ“ºÜ´ó”£¬¿¼ÂÇÁ˺ฺܶÔؾùºâ·½ÃæµÄ¶«Î÷£¬±ÈÈç²ÉÓÃnginx½«phpµÄÇëÇó·Ö̯µ½Èô¸É¸öÔËÐÐphp fastcgiµÄ¶ÀÁ¢·þÎñÆ÷ÖС£ÕâÑùµÄÉè¼Æ³ýÁËÔÚÿ¸öphp fastcgi·þÎñÆ÷ÖÐÒª±£´æÒ»·Ý³ÌÐòµÄ¿½±´ÒÔÍ⣬»¹ÓÐÒ»¸öؽ´ý½â¾öµÄÎÊÌâ¡£ÓÉÓÚphp fastcgi½ø³Ì·Ö±ðÔËÐÐÔ ......
PHP³ÌÐòÔ±×îÒ×·¸10ÖÖ´íÎó(ת)
php 2008-07-11 23:45 ÔĶÁ5 ÆÀÂÛ0
×ֺţº ´ó´ó ÖÐÖРСС
PHPÊǸöΰ´óµÄweb¿ª·¢ÓïÑÔ£¬Áé»îµÄÓïÑÔ£¬µ«ÊÇ¿´µ½php³ÌÐòÔ±Öܶø¸´Ê¼µÄ·¸µÄһЩ´íÎó¡£ÎÒ×öÁËÏÂÃæÕâ¸öÁÐ±í£¬ÁгöÁËPHP³ÌÐòÔ±¾³£·¸µÄ10ÖдíÎ󣬴ó¶àÊýºÍ°²È«Ïà¹Ø¡£¿´ ......