ʵÀýÏê½âPHP serializeÓëJSON½âÎö
JSON
»ù
ÓÚJavaScript Programming Language, Standard ECMA-262 3rd Edition -
December 1999µÄÒ»¸ö×Ó¼¯¡£JSON²ÉÓÃÍêÈ«¶ÀÁ¢ÓÚÓïÑÔµÄÎı¾¸ñʽ£¬µ«ÊÇҲʹÓÃÁËÀàËÆÓÚCÓïÑÔ¼Ò×åµÄÏ°¹ß£¨°üÀ¨C, C++, C#, Java
, JavaScript, Perl, PythonµÈ£©¡£ÕâЩÌØÐÔʹJSON³ÉΪÀíÏëµÄÊý¾Ý½»»»ÓïÑÔ¡£
JSON½¨¹¹ÓÚÁ½Öֽṹ£º
“Ãû
³Æ/Öµ”¶ÔµÄ¼¯ºÏ£¨A collection of name/value
pairs£©¡£²»Í¬µÄÓïÑÔÖУ¬Ëü±»Àí½âΪ¶ÔÏó£¨object£©£¬¼Í¼£¨record£©£¬½á¹¹£¨struct£©£¬×ֵ䣨dictionary£©£¬¹þÏ£±í
£¨hash table£©£¬ÓмüÁÐ±í£¨keyed list£©£¬»òÕß¹ØÁªÊý×é £¨associative array£©¡£
ÖµµÄÓÐÐòÁÐ±í£¨An ordered list of values£©¡£Ôڴ󲿷ÖÓïÑÔÖУ¬Ëü±»Àí½âΪÊý×飨array£©¡£
PHP
µÄserialize
Êǽ«±äÁ¿ÐòÁл¯£¬·µ»ØÒ»¸ö¾ßÓбäÁ¿ÀàÐͺͽṹµÄ×Ö·û´®±í´ïʽ£¬
˵ÆðÀ´Á½Õ߶¼ÊÇÒÔÒ»ÖÖ×Ö·û´®µÄ·½Ê½À´ÌåÏÖÒ»ÖÖÊý¾Ý½á¹¹£¬ÄÇËüÃÇÖ®¼äÓÐʲôÇø±ðÄØ¡£
ÏÈ´ÓJSON˵Æ𣬿´Ò»¸ö¼òµ¥µÄʵÀý
¡£
ÀýÒ»:
var
test = {
"Name"
:
"Peter"
,
"Age"
:20};
document.write(test.Name +
": "
+ test.Age);
ÏÔʾ½á¹û:
Peter: 20
±äÁ¿testÖÐ{"Name":"Peter","Age":20}Ϊһ¸öÓÐ2¸öÔªËصĶÔÏ󣨸оõ¾ÍÏñPHPµÄÊý×飩£º
NameΪPeter£¬AgeΪ20¡£
µ±È»Ò²¿ÉÒÔ±äµÃ¸´ÔÓЩ¡£
Àý¶þ:
var
test
= {"User":{"Name":"Peter","Age":20},"Company":"FORD"};
document.write(test.User.Name + ": " + test.Company);
ÏÔʾ½á¹û:
Peter: FORDÕâ¸öÀý×ÓÖÐUserÔªËØÖаüº¬ÁËNameºÍAge¡£
Èç¹ûÒªÌåÏÖ¶à¸öUser£¬ÔòÐèҪʹÓÃÊý×飬Çø±ðÓÚ¶ÔÏóµÄ"{}"£¬Êý×éʹÓÃ"[]"¡£
JSON½âÎöÀýÈý:
var
test
= [
{"User":{"Name":"Peter","Age":20},"Company":"FORD"},
{"User"
Ïà¹ØÎĵµ£º
1£ºsmarty »º´æµÄÅäÖÃ
Php´úÂë
$smarty->cache_dir = "/caches/"; //»º´æĿ¼
$smarty->caching = true; //¿ªÆô»º´æ,ΪflaseµÄʱºî»º´æÎÞЧ
$smarty->cache_lifetime = 60; //»º´æʱ¼ä
2:smarty»º´æµÄʹÓúÍÇå³ý
Php´úÂë
$smarty->di ......
1£¬DateTimeÀàÐÍÊý×Ö
ÒÔÏÂÊÇÒýÓÃƬ¶Î£º
µ±Ç°Ê±¼äSystem.DateTimeµÄ=ÐÂSystem.DateTimeµÄ£¨£©;
1.1Сʱ·ÖÖÓµ±Ç°ÈÕÆÚÃ룬µ±Ç°Ê±¼ä= System.DateTime.Now;
1.2¼ì²é±¾Äê¶ÈÁ®ÕþÄê= currentTime.Year;
1.3µ±Ç°Ô·ÝÁ®Õþ¸öÔÂ= currentTime.Month;
1,4²ÉÈ¡µ±ÌìÁ®ÕþÌì= currentTime.Day;&n ......
YiiÊÇÒ»¸ö¸ßÐÔÄܵÄPHP5µÄwebÓ¦ÓóÌÐò¿ª·¢¿ò¼Ü¡£Í¨¹ýÒ»¸ö¼òµ¥µÄÃüÁîÐй¤¾ß yiic ¿ÉÒÔ¿ìËÙ´´½¨Ò»¸öwebÓ¦ÓóÌÐòµÄ´úÂë¿ò¼Ü£¬¿ª·¢Õß¿ÉÒÔÔÚÉú³ÉµÄ´úÂë¿ò¼Ü»ù´¡ÉÏÌí¼ÓÒµÎñÂß¼£¬ÒÔ¿ìËÙÍê³ÉÓ¦ÓóÌÐòµÄ¿ª·¢¡£
а汾ÐÞÕýÁË´óÁ¿µÄbug£¬¶Ô³¬¹ý20ÏîµÄ¹¦ÄܽøÐÐÁ˸Ľø£»Í¨¹ýɾ³ýÎÞÓÃµÄ SQL JOIN À´ÌáÉýÁËÀÁģʽϹØϵ AR ²éѯµÄÐÔÄÜ¡£
......
ÍøÉÏÕÒµ½µÄ£º¹²ÏíÒ»ÏÂ
<?
//¡¾¾¯¸æ¡¿:δ¾Ðí¿ÉÇëÎðËæ±ãÐÞ¸Ä
//-----------------------------------------------------------------------------------
-------
//-----------------------------------------------------------------------------------
-------
//
// ¡¾ÎļþÃû¡¿: c_check.inc
// ¡¾× ......
<?php
class SubPages{
private $each_disNums;//ÿҳÏÔʾµÄÌõÄ¿Êý
private $nums;//×ÜÌõÄ¿Êý
private $current_page;//µ±Ç°±»Ñ¡ÖеÄÒ³
private $sub_pages;//ÿ´ÎÏÔʾµÄÒ³Êý
private $pageNums;//×ÜÒ³Êý
private $page_array = array();//ÓÃÀ´¹¹Ôì·ÖÒ³µÄÊý×é ......