php»ñµÃ¶þά»ò¶àάÊý×éµÄµÚһάµÄ³¤¶È
ÔÚphpÖУ¬»ñµÃ¶þά»ò¶àάÊý×éµÄµÚһάµÄ³¤¶È£¬ÕâÊǸö³£ÓõijÌÐòÅжϣ¬±ÈÈçÄã¶ÁÈ¡µÄÊý×éÊÇÒ»¸ö¶þάÊý×飺
<?php
$arr=array(
0=>array('title' => 'ÐÂÎÅ1', 'viewnum' => 123, 'content' => 'ZAQXSWedcrfv'),
1=>array('title' => 'ÐÂÎÅ2', 'viewnum' => 99, 'content' => 'QWERTYUIOPZXCVBNM')
);
?>
Èç¹ûÄãÏëͳ¼ÆÊý×é$arrµÄ³¤¶È£¬Ò²¾ÍÊÇ˵¸Ã¶þάÊý×éÖ»ÓÐÁ½ÌõÐÂÎÅ£¬ÄãÏëÒªµÄÊý×ÖÒ²ÊÇ2£¬µ«ÊÇÈç¹ûʹÓÃcount($arr)²»Í¬°æ±¾µÄphp£¬Í³¼ÆµÄ½á¹ûÊDz»Ò»ÑùµÄ£»
ºóÀ´ÔÚphpÊÖ²áÖз¢ÏÖ£¬countº¯Êý»¹Óеڶþ¸ö²ÎÊý£¬½âÊÍÈçÏ£º
countº¯ÊýÓÐÁ½¸ö²ÎÊý£º
0(»òCOUNT_NORMAL)ΪĬÈÏ,²»¼ì²â¶àάÊý×é(Êý×éÖеÄÊý×é);
1(»òCOUNT_RECURSIVE)Ϊ¼ì²â¶àάÊý×飬
ËùÒÔÈç¹ûÒªÅж϶ÁÈ¡µÄÊý×é$arrÊDz»ÊÇÓÐÐÂÎÅÐÅÏ¢£¬¾ÍÒªÕâÑùдÁË£º
<?php
if(is_array($arr) && count($arr,COUNT_NORMAL)>0 )
{
.....
} else {
.....
}
?>
Äã¿ÉÒÔʹÓÃÕâÑùµÄ´úÂëÀ´²âÊԸú¯Êý£º
<?php
$arr=array(
0=>array('title' => 'ÐÂÎÅ1', 'viewnum' => 123, 'content' => 'ZAQXSWedcrfv'),
1=>array('title' => 'ÐÂÎÅ2', 'viewnum' => 99, 'content' => 'QWERTYUIOPZXCVBNM')
);
echo '²»Í³¼Æ¶àάÊý×飺'.count($arr,0);//count($arr,COUNT_NORMAL)
echo "<br/>";
echo 'ͳ¼Æ¶àάÊý×飺'.count($arr,1);//count($arr,COUNT_RECURSIVE)
?>
ºÃÁË£¬µ½´ËλÖã¬ÒѾ½â¾öphpÖлñÈ¡¶þά»ò¶àάÊý×éµÄµÚһά³¤¶ÈµÄÎÊÌ⣡
Ïà¹ØÎĵµ£º
¹ØÓÚÔÚAJAXÖÐGET»ØµÄResponseTextÖÐÎÄÂÒÂëµÄ×î¼ò½â¾ö°ì·¨
//Èç¹û´«ËͲÎÊýÊÇÖ±½Ó¸³ÓèµÄ£¬¾Í»á²úÉúÂÒÂë!
´úÂëÈçÏÂ:
http_request.open("POST",url,true);
http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
http_request.send("action="+strName+"&val="+val); //Èç¹ûvalµÄ ......
cache ʹÓãº
cacheÅäÖãº
$smarty->cache_dir = "/caches/"; //»º´æĿ¼
$smarty->caching = true; //¿ªÆô»º´æ,ΪflaseµÄʱºî»º´æÎÞЧ
$sma ......
֮ǰÍøÒ³µÄchartsetÓõÄÊÇutf-8£¬ÎļþÒ²ÓÃutf-8£¬È»ºóÓÃfopen()´´½¨Ò»¸öÖÐÎÄÎļþÃûµÄÎļþʱÎÊÌâ¾Í³öÀ´ÁË£¬ÎļþÃû¶¼ÊÇÂÒ
Â룡
²é¿´Á˺ܶàÎĵµÊÔÁ˲»ÉÙ·½·¨¶¼½â¾ö²»ÁË£¬±¾À´Ïë×ÅÓñðµÄ·½·¨ÈƹýÕâ¸öÎÊÌ⣬ºöÈ»ÄÔ×ÓÀïÉÁ¹ýWindowsĬÈϵÄÎÄ×Ö±àÂëÊÇansi£¬È»ºóÔÙ
baiduÁËһϣ¬Ö¤ÊµÁËÕâµã£¬ËùÒÔÎÒµÄÍøÒ³Ò²Ó¦¸ÃÊÇansi±àÂë²ÅÄÜʹ´ ......
<?php
@mysql_connect("localhost", "root","1981427") //Ñ¡ÔñÊý¾Ý¿â֮ǰÐèÒªÏÈÁ¬½ÓÊý¾Ý¿â·þÎñÆ÷
or die("Êý¾Ý¿â·þÎñÆ÷Á¬½Óʧ°Ü");
$dbs = mysql_list_dbs(); //µ÷ÓÃmysql_list_dbsº¯Êý
while ($array = mysql_fetch_row($dbs)) //Ñ»·Êä³öËùÓеÄÊý¾Ý¿âÃû³Æ
{
echo "$array[0]<BR>";
}
?>
& ......