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
Ïà¹ØÎĵµ£º
scrollHeight: »ñÈ¡¶ÔÏóµÄ¹ö¶¯¸ß¶È¡£
scrollLeft:ÉèÖûò»ñȡλÓÚ¶ÔÏó×ó±ß½çºÍ´°¿ÚÖÐÄ¿Ç°¿É¼ûÄÚÈݵÄ×î×ó¶ËÖ®¼äµÄ¾àÀë
scrollTop:ÉèÖûò»ñȡλÓÚ¶ÔÏó×¶ËºÍ´°¿ÚÖпɼûÄÚÈݵÄ×¶ËÖ®¼äµÄ¾àÀë
scrollWidth:»ñÈ¡¶ÔÏóµÄ¹ö¶¯¿í¶È
offsetHeight:»ñÈ¡¶ÔÏóÏà¶ÔÓÚ°æÃæ»òÓɸ¸×ø±ê offsetParent ÊôÐÔÖ¸¶¨µÄ¸¸×ø±êµÄ¸ß¶È
offsetL ......
Ò»¡¢ÑéÖ¤Àà
1¡¢Êý×ÖÑéÖ¤ÄÚ
1.1 ÕûÊý
1.2 ´óÓÚ0µÄÕûÊý £¨ÓÃÓÚ´«À´µÄIDµÄÑéÖ¤)
1.3 ¸ºÕûÊýµÄÑéÖ¤
1.4 ÕûÊý²»ÄÜ´óÓÚiMax
1.5 ÕûÊý²»ÄÜСÓÚiMin
2¡¢Ê±¼äÀà
2.1 ¶Ìʱ¼ä£¬ÐÎÈç (13:04:06)
2.2 ¶ÌÈÕÆÚ£¬ÐÎÈç (2003-12-05)
2.3 ³¤Ê±¼ä£¬ÐÎÈç (2003-12-05 13:04:06)
2.4 Ö»ÓÐÄêºÍÔ¡£ÐÎÈç(2003-05,»òÕß2003-5)
2.5 ......
ÎÒÃÇÀ´Ä£·ÂÒ»ÏÂ×îOOµÄmootoolsµÄ¼Ì³Ð»úÖÆ¡£ËüµÄÀ඼ÓÐÒ»¸ö½Ð×öinitialize¹¹Ôì·½·¨£¬ÕâÓëJavaµÄÀ඼ÓÐÒ»¸öÓëÀàÃûͬÃûµÄ¹¹Ôì·½·¨Ò»ÑùµÄµÀÀí¡£Ö»²»¹ý£¬ÕâЩ½Ðinitialize»òinit¶¼Êǽè¼ø×ÔPrototype£¬¶øPrototypeÄÇ°ïÈËÊÇRuby³öÉí¡£ÎªÁËÇø±ðmootoolsÄÇÖÖÎÛȾÔÉú·½·¨µÄ×ö·¨£¬ÎÒ°ÑÀàµÄ¹¹ÔìÆ÷ÃüÃûΪvariant£¬²¢ÇÒ½ûÖ¹²é¿´¹¹Ô ......
½üÈÕÔÚÓÃ×Ô¼ºÒÔǰдµÄhttpÏÂÔØÆ÷ÏÂÔØijһ¸öphpÒ³ÃæÒÔÍâÔâÓö403´íÎó.µ«ÊÇieÈ´Äܹ»ÕýÈ··ÃÎÊ. ÈÕÖ¾ÈçÏÂ: IE: Time At:0005504671
Line:10
send: 192.168.1.2 –> xxx.xxx.xxx.xxx len:351
GET /test.jpg HTTP/1.1
Accept: */*
Accept-Language: en-us
Accept-Enc ......
×÷Õߣºhttp://blog.csdn.net/zhoufoxcn/archive/2009/11/05/4769858.aspx
˵Ã÷£ºÒòΪ×î½ü¹¤×÷¹¤×÷¹Øϵ£¬ÐèÒª¿ª·¢Ò»¸öÔÚLinuxÏÂÔËÐеÄWeb
Application£¬ÐèÒª¶ÔÏÖÔڱȽÏÁ÷ÐеÄһЩPHP¿ò¼Ü×öÒ»¸öÁ˽âºÍÆÀ¹À£¬ÏÂÃæµÄÕâƪÎÄÕÂÊDZÊÕß×î½üѧϰһ¸ö±È½ÏеÄPHP
FrameworkµÄÒ»µã¾ÀúºÍ²Ù×÷²½Ö裬ÒòΪ¹Ù·½µÄÊÖ²áдµÃ±È½Ï»Þ ......