һƪ²»´íµÄphpÊý×éѧϰ±Ê¼Ç
»ù±¾¸ÅÄî
PHP ÖеÄÊý×éʵ¼ÊÉÏÊÇÒ»¸öÓÐÐòͼ¡£Í¼ÊÇÒ»ÖÖ°Ñ values Ó³Éäµ½ keys µÄÀàÐÍ¡£Òò´Ë¼È¿ÉÒÔ°ÑphpµÄÊý×éµ±×öÆÕͨÊý×éʹÓã¬Ò²¿ÉÒÔÓÃËüÀ´Ä£Äâ×ֵ䡢¼¯ºÏ¡¢Õ»¡¢¶ÓÁС¢Ê÷µÈ¶àÖÖÆäËûÊý¾Ý½á¹¹¡£
Êý×éµÄ´´½¨£º
´´½¨Êý×éµÄÒ»°ã¸ñʽΪ£º$arrName = array( [key =>]value, ...)£¬ÆäÖÐkey ¿ÉÒÔÊÇ integer »òÕß string£¬¶øvalue ¿ÉÒÔÊÇÈκÎÖµ¡£
ʾÀý£º
$arr1 = array('aaa', 'bbb');
$arr2 = array('a'=>'AAA', 'b'=>'BBB');
´´½¨¿ÕÊý×飺$arr = array();
Èç¹ûÊý×é²»´æÔÚ£¬ÄÇôÏòÊý×é´æ·ÅÖµ½«´´½¨Êý×飬µ«ÊÇÔÚÒ»¸ö»¹Ã»Óж¨ÒåµÄÊý×éÖмìË÷Ò»¸öÖµ²»»á´´½¨Êý×é¡£
$arr[0] = 'aaa';
$arr[1] = 'bbb';
foreach($arr as $v){
echo $v;
}
²Ù×÷Êý×é
1£ºÔÚÊý×éĩβÌí¼ÓÖµ
$arr = array('a'=>'AAA', 'b'=>'BBB');
$arr[] = 'CCC';
2:±éÀúÊý×é
·½·¨1
$arr = array('a'=>'AAA', 0=>'BBB');
foreach($arr as $a){
echo $a;
}
·½·¨2
$array = array(1, 2);
$count = count($array);
for ($i = 0; $i < $count; $i++) {
echo $array[$i];
}
3£ºÇå¿ÕÕû¸öÊý×é
unset($arr);
4£ºÇå¿ÕÖ¸¶¨ÔªËØ
unset($arr[index]);
³£ÓÃÊý×麯Êý
print_r($arr);
²é¿´Êý×éÐÅÏ¢£»
unset();
¸Ãº¯ÊýÔÊÐíÈ¡ÏûÒ»¸öÊý×éÖеļüÃû¡£Òª×¢ÒâÊý×齫²»»áÖؽ¨Ë÷Òý¡£
$a = array( 1 => 'one', 2 => 'two', 3 => 'three' );
unset( $a[2] );
/* ½«²úÉúÒ»¸öÊý×飬¶¨ÒåΪ
$a = array( 1=>'one', 3=>'three');
¶ø²»ÊÇ
$a = array( 1 => 'one', 2 => 'three');
*/
count()»òÕßsizeof()
»ñµÃÊý×é´óС£»
array_pad()
Ìî³äÊý×é
ÁãËé֪ʶµã
phpµÄÊý×é·ÖΪÁ½ÖÖÊý×飺Ë÷ÒýÊý×éºÍ¹ØÁªÊý×é¡£Ë÷ÒýÊý×éµÄ¼üֵΪÕûÊý£¬´Ó0¿ªÊ¼£»¹ØÁªÊý×éµÄ¼üֵΪ×Ö·û´®¡£
²»¹ÜÊÇË÷ÒýÊý×黹ÊǹØÁªÊý×飬¼üÖµ¶¼²»ÄÜÖظ´¡£Öظ´µÄ»°£¬Ö®Ç°µÄÖµ»á±»¸²¸Ç¡£
$arr[1] Óë $arr['1']ÒýÓÃÏàͬµÄÔªËØ£¬µ«Óë arr['01'] ÒýÓò»Í¬ÔªËØ¡£
¹ØÁªÊý×éµÄË÷ÒýÖµÒª¼Óµ¥ÒýºÅ»òÕßË«ÒýºÅ£¬ÔÚphp5Öв»¼ÓÒýºÅ»á±¨´í¡£µ«ÔÚ×Ö·û´®ÖÐÒýÓÃÊý×éÔªËØʱÔò²»ÄܼÓÒýºÅ¡£
$arr['a'] = 'AAA';
$arr['b'] = 'BBB';
echo "array[a] is $arr[a]";
ÎÄÕÂÀ´Ô´£ºhttp://www.phpbegin.com/foundation/2009/0817/1397.html
Ïà¹ØÎĵµ£º
»·¾³Èí¼þ°æ±¾½éÉÜ£º
APACHE 2.0.59
PHP5.2.3
MYSQL5.0.45
GD-2.0.35
Zend Optimizer v3.3.0
&n ......
Ò»¡¢¹æ·¶Ç°ÑÔƪ
±ê×¼»¯²»ÊÇÌØÊâµÄ¸öÈË·ç¸ñ£¬ËüÈóÌÐòÔ±¿ÉÒÔÁ˽âÈκδúÂ룬ŪÇå³ÌÐòµÄ×´¿ö£»ÐÂÈË¿É
ÒԺܿìµÄÊÊÓ¦»·¾³£»·ÀֹнӴ¥phpµÄÈËÒ»´Î´ÎµÄ·¸Í¬ÑùµÄ´íÎó£»ÔÚÒ»ÖµĿª·¢»·¾³Ï£¬
¿ÉÒÔ¼õÉÙÈËÃÇ·¸´íµÄ»ú»á¡£±¾¹æ·¶µÄ±ê×¼ÔÚ¾ø¶Ô¶àÊýÓ¦ÓÃÉÏΪ·ÂÕÕjava¼¼ÊõÌåϵ£¬ÒòΪ
java¼¼ÊõÌåϵÒÔÆäÖÚ¶à³É¹¦µÄ°¸Àý³ÉΪ´ó²¿·Ö¼ÆËã»úÓ¦Ó ......
Ò». Ê×ÏÈ×öÒ»¸ö¼òµ¥µÄsoÎļþ£º
/**
* hello.c
* To compile, use following commands:
* gcc -O -c -fPIC -o hello.o hello.c
* gcc -shared ......
Apache Httpd PHP»·¾³´î½¨
1¡¢°²×°Apache·þÎñÆ÷
2¡¢ÐÞ¸Ähttpd.conf ÖÐ ServerName localhost:9080 ºÍListen 9080
3¡¢°²×°PHP5,ÀàÐÍÑ¡ÔñApache2.*£¬Ñ¡ÔñApacheÅäÖÃÎļþĿ¼¡£
4¡¢ÐÞ¸Ähttpd.confÖÐPHP5Ôö¼ÓµÄÅäÖÃΪÈç¹ûÄÚÈÝ£º
#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
& ......