ÔÚPHPÖбéÀúÊý×éÔªËØ
ÔÎÄÁ´½Ó£ºhttp://www.phpdo.net/index.php/20100411/56.html
ÔÚPHPÖÐʹÓÃforeachº¯Êý¿ÉÒÔ±éÀúÊý×é¡£Foreach½öÄÜÓÃÓÚÊý×飬Óï·¨ÈçÏ£º
Foreach(array as $value) statements
Foreach(array as $key=>$value) statement
µÚÒ»ÖÖÓï·¨±éÀúÊý×éʱ£¬Ã¿´ÎÑ»·Ê±£¬µ±Ç°µ¥ÔªµÄÖµ±»¸³¸ø$value£¬Êý×éÄÚ²¿µÄÖ¸ÕëÏòÇ°ÒÆÒ»Î»¡£
ÀýÈ磺
<?php
$php = array(0=>”php”,1=>”phpdo”,2=>”www.phpdo.net”);
foreach($php as $value)
{
echo “value:$value;”;
}
echo “<BR>”;
//µÚ¶þÖÖÓï·¨±éÀúʱ£¬ÔÚÿ´ÎÑ»·Ê±£¬¼üÖµ»á±»¸³Öµ¸ø±äÁ¿key.
foreach($php as $key=>$value)
{
echo “key:$key;value:$value”;
}
?>
½á¹û£º
value:php;value:phpdo;value:www.phpdo.net;
key:0;value:phpkey:1;value:phpdokey:2;value:www.phpdo.net
¶ÔÓÚ¶àάÊý×éÈç¿ÉʹÓÃÄØ£¿
û´í¡£ÄúÒ»¶¨Ïëµ½Á˰ɣ¿
ÀýÈ磺
<?php
$php = array(“php1″=>array(0=>”php”,1=>”phpdo”),”php2″=>array(0=>”phpdo.net”,1=>”www.phpdo.net”));
foreach($php as $value1)
{
foreach($value1 as $value2)
{
echo “$value2\n”;
}
}
?>
½á¹û£º
php phpdo phpdo.net www.phpdo.net
Ïà¹ØÎĵµ£º
¶þ·ÖÖÓ: ½¨Á¢Ò»¸ö CodeIgniter ÍøÕ¾
ÓÃCI½¨Ò»¸öÍøÕ¾ºÜÈÝÒס£ ÕâÒ»Õº̣ܶ¬½âÊÍÁËÓÃCIÖÆ×÷ÍøÕ¾Ê±·¢ÉúÁËЩʲô£¬ÄÄЩÎļþ±»´´½¨£¬ÈÃÎÒÃÇÀ´ÇÆÒ»ÇÆ£º
. ´´½¨ÍøÕ¾ÐèҪʲôÈí¼þ£¿
. °²×° CI Îļþ: Ò»¸ö¼òµ¥µÄÏÂÔØºÍ½âѹËõ²Ù×÷
. CI µÄ»ù±¾ÉèÖÃ: ÓÐÄÄЩÎļþ¼Ð¼°ËüÃÇÊÇÈçºÎ×éÖ¯µÄ
. CI °²×°Ê±Ä¬ÈϵĿØÖÆÆ÷ºÍÊÓͼ
. һЩ¼òµ¥µÄ ......
<?PHP
/**
* HTTP Protocol defined status codes
* @param int $num
*/
function https($num) {
$http = array (
100 => "HTTP/1.1 100 Continue",
101 => "HTTP/1.1 101 Switching Protocols",
200 => "HTTP/1.1 200 OK",
201 => "HTTP/1.1 201 Created",
202 => "HTTP/1.1 202 ......
<?
//------------------------
// PHPÄÚÖÃ×Ö·û´®º¯ÊýʵÏÖ
//------------------------
//×Ö·û´®³¤¶È
function strlen ($str)   ......
mb_convert_encodingÕâ¸öº¯ÊýÊÇÓÃÀ´×ª»»±àÂëµÄ¡£ÔÀ´Ò»Ö±¶Ô³ÌÐò±àÂëÕâÒ»¸ÅÄî²»Àí½â£¬²»¹ýÏÖÔÚºÃÏñÓе㿪ÇÏÁË¡£
²»¹ýÓ¢ÎÄÒ»°ã²»»á´æÔÚ±àÂëÎÊÌ⣬ֻÓÐÖÐÎÄÊý¾Ý²Å»áÓÐÕâ¸öÎÊÌâ¡£±ÈÈçÄãÓÃZend Studio»òEditplusд³ÌÐòʱ£¬ÓõÄÊÇgbk±àÂ룬Èç¹ûÊý¾ÝÐèÒªÈëÊý¾Ý¿â£¬¶øÊý¾Ý¿âµÄ±àÂëΪutf8ʱ£¬Õâʱ¾ÍÒª°ÑÊý¾Ý½øÐбàÂëת»»£¬²»È»½øµ½Ê ......
Óû§¶¨ÒåµÄÀ࣬ҲÊÇѧºÃ PHP Ëù±Ø±¸µÄÌõ¼þÖ®Ò»¡£¶ø PHP µÄÀ࣬ºÍÆäËüµÄÃæÏò¶ÔÏóÓïÑÔ±È½ÏÆðÀ´£¬»¹ËãÂùµ¥´¿µÄ¡£PHP Ö»ÓÐÀà±ð (class)¡¢·½·¨ (method)¡¢ÊôÐÔ¡¢ÒÔ¼°µ¥Ò»¼Ì³Ð (extensions) µÈ¡£¶Ô²»Ï°¹ßʹÓà C++¡¢Java¡¢Delphi µÈÃæÏò¶ÔÏóÓïÑÔÀ´¿ª·¢³ÌÐòµÄÓû§£¬²»·ÁÏÈÔĶÁÒ»ÏÂÓйØÃæÏò¶ÔÏó¸ÅÄîµÄÊ飬ÏàÐÅ¿ÉÒÔ´øÀ´Ðí¶àµÄÊÕ»ñ¡£
......