PHPÊý×éµÄʹÓúͱéÀú
1¡¢Êý×éµÄÉêÇëºÍʹÓãº
$array=array(array(2,324,34));
echo $array[0][1];
Ö±½ÓÉêÇëʹÓãº
$student[0][0]="ÎÒ";
$student[0][1]="ÊÇ";
$student[1][0]="Ë";
$student[1][1]="ά";
echo $student[1][0];
2¡¢±éÀú£º
foreach()ÊÇÒ»¸öÓÃÀ´±éÀúÊý×éÖÐÊý¾ÝµÄ×î¼òµ¥ÓÐЧµÄ·½·¨¡£
<?php
$colors = array('red','blue','green','yellow');
foreach ($colors as $color) {
echo "Do you like $color? <br />";
}
?>
ÏÔʾ½á¹û£º
Do you like red?
Do you like blue?
Do you like green?
Do you like yellow?
2. while()
while() ͨ³£ºÍ list()£¬each()ÅäºÏʹÓá£
#example2:
<?php
$colors = array('red','blue','green','yellow');
while(list($key,$val) = each($colors)) {
echo "Other list of $val.<br />";
}
?>
ÏÔʾ½á¹û£º
Other list of red.
Other list of blue.
Other list of green.
Other list of yellow.
3. for()
#example3:
<?php
$arr = array ("0" => "zero","1" => "one","2" => "two");
for ($i = 0;$i < count($arr); $i++) {
$str = $arr[$i];
echo "the number is $str.<br />";
}
?>
ÏÔʾ½á¹û£º
the number is zero.
the number is one.
the number is two.
========= ÒÔÏÂÊǺ¯Êý½éÉÜ ==========
key()
mixed key(array input_array)
key()º¯Êý·µ»Øinput_arrayÖÐλÓÚµ±Ç°Ö¸ÕëλÖõļüÔªËØ¡£
#example4
ÏÂÔØ: list_array04.php
<?php
$capitals = array("Ohio" => "Columbus","Towa" => "Des Moines","Arizona" => "Phoenix");
echo "<p>Can you name the capitals of these states?</p>";
while($key = key($capitals)) {
echo $key."<br />";
next($capitals);
//ÿ¸ökey()µ÷Óò»»áÍÆ½øÖ¸Õ롣Ϊ´ËҪʹÓÃnext()º¯Êý
}
?>
ÏÔʾ½á¹û£º
Can you name the capitals of these
Ïà¹ØÎĵµ£º
<?php
/*ʹÓÃÎı¾Îļþ¼Ç¼Êý¾ÝµÄ¼òµ¥ÊµÏÖ*/
$counter=1;
if(file_exists("mycounter.txt")){
$fp=fopen("mycounter.txt","r");
$counter=fgets($fp,9);
$counter++;
fclose($fp);
}
$fp=fopen("mycounter.txt","w");
fputs($fp,$counter);
fclose($fp);
echo "<h1>ÄúÊǵÚ".$counter."´Î·ÃÎʱ¾Ò³ ......
1¡¢PHP·¢ËÍÖÐÎÄ¡¢Ajax½ÓÊÕ
Ö»ÐèÔÚphp¶¥²¿¼ÓÈëÒ»¾ä£º
header('Content-type: text/html;charset=GB2312');
xmlHttp»áÕýÈ·½âÎöÆäÖеÄÖÐÎÄ¡£
2¡¢Ajax·¢ËÍÖÐÎÄ¡¢PHP½ÓÊÕ
Õâ¸ö±È½Ï¸´ÔÓ£º
AjaxÖÐÏÈÓÃencodeURIComponent¶ÔÒªÌá½»µÄÖÐÎĽøÐбàÂë
PHPÖУº
$GB2312string=iconv( ‘UTF-8′, ‘gb2312//I ......
±¾½Ì³Ì²ÉÓõÄÊÇxampp×Ô´øµÄtomcat²å¼þÀ´Íê³ÉÕûºÏµÄ£¬ËùÒÔ£¬ÒªÏëÍê³ÉÕûºÏ£¬µÚÒ»²½²»ÐèÏÂÔØxampp£¬¼°Æätomcat²å¼þ~
1.´ò¿ªxampp¹ÙÍø µã´Ëxampp¹ÙÍø´ò¿ª
&n ......
ÕªÒª ±¾ÎĽéÉÜPHPµÄÓŵãºÍÌØÕ÷£¬½áºÏʵÀý²ûÊöÁËPHP·ÃÎÊMySQLÊý¾Ý¿âµÄ·½·¨¡£
PHP MySQL ODBC
1. ÒýÑÔ
ÔÚInternetÓ¦ÓÃÖУ¬½«·þÎñÆ÷¶Ë½Å±¾¼¼ÊõºÍ¿Í»§¶Ë½Å±¾¼¼Êõ½áºÏÆðÀ´¿ÉÒÔÖÆ×÷³ö·á¸»¶à²ÊµÄÒ³Ãæ¡£CGIºÍASPÊDZȽÏÁ÷ÐеķþÎñÆ÷¶Ë½Å±¾¼¼Êõ¡£Í¨³£CGIÔÚ¿çÆ½Ì¨µÄ¿ª·¢ÖаçÑÝ×ÅÖ÷Òª½ÇÉ«£¬¿ÉÒÔʹÓÃVB¡¢C»òPerlµÈÀ´Ê ......
ÓÐʱºònginx£¬apache£¬mysql£¬php±àÒëÍêÁËÏë¿´¿´±àÒë²ÎÊý¿ÉÒÔÓÃÒÔÏ·½·¨
nginx±àÒë²ÎÊý£º
#/usr/local/nginx/sbin/nginx -V
CODE:
nginx version: nginx/0.6.32
built by gcc 4.1.2 20071124 (Red Hat 4.1.2-42)
configure arguments: --user=www --group=www --prefix=/usr/local/nginx/ --with-http_stub_status_mo ......