Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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:global±äÁ¿µÄʹÓÃ

global¶¨ÒåÒ»¸öÈ«¾Ö±äÁ¿£¬Õâ¸öÈ«¾Ö±äÁ¿²»ÊÇÓ¦ÓÃÕû¸öÍøÕ¾£¬¶øÊÇÓ¦ÓÃÓëµ±Ç°Ò³Ãæ£¨°üÀ¨requireºÍincludeÎļþ£©Îļþ¡£
$aa="test";
function test()
{
    global $aa;
    echo $aa;
}
test(); //print test
º¯ÊýÄÚ¶¨ÒåµÄ±äÁ¿º¯ÊýÍâ¿ÉÒÔµ÷Óã¬ÔÚº¯ÊýÍⶨÒåµÄµÄ±äÁ¿º¯ÊýÄÚ²»ÄÜʹÓá£
gl ......

PHPʵÏÖÔ²½ÇͼƬ

¹¤×÷ÖÐÓõ½£¬×Ô¼ºÐ´ÁËÒ»¸ö£¬·ÖÏí¸øÓÐÐèÒªµÄÈË£¬Ç°ÃæÊÇÀඨÒ壬ºóÃæ2ÐÐÊǵ÷Óá£
Óŵ㣺
²»ÐèÒªÍⲿͼƬ
Ö§³ÖPNG͸Ã÷
¿É×Ô¶¨ÒåÔ²½Ç°ë¾¶
²»×㣺
Ö»ÄÜÖ¸¶¨Ò»ÖÖ͸Ã÷É«
 <?php
class RoundedCorner {
private $_r;
private $_g;
private $_b;
private $_image_path;
private $_radius;

function _ ......

phpѧϰ±Ê¼Ç

 1¡¢$_SERVER['SCRIPT_NAME']¡¢$_SERVER['PHP_SELF']ºÍ$_SERVER['REQUEST_URI']Çø±ð
Àý×Ó:http://localhost/phpwind75/test.php/%22%3E%3Cscript%3Ealert(’xss’)%3C/script%3E%3Cfoo
$_SERVER['SCRIPT_NAME']Ö»»ñÈ¡½Å±¾Ãû£¬²»»ñÈ¡²ÎÊý,Êä³ö½á¹ûΪ:test.php;
$_SERVER['PHP_SELF']»ñÈ¡½Å±¾Ãûºó£¬Í¬Ê±»ñÈ ......

PHP¼òµ¥¼ÆÊýÆ÷

 <?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."´Î·ÃÎʱ¾Ò³ ......

Linux+Apache+Mysql+PHPµäÐÍÅäÖÃ


°æÈ¨ÉùÃ÷£º¿ÉÒÔÈÎÒâ×ªÔØ£¬×ªÔØÊ±ÇëÎñ±ØÒÔ³¬Á´½ÓÐÎʽ±êÃ÷ÎÄÕÂԭʼ³ö´¦ºÍ×÷ÕßÐÅÏ¢¼°±¾ÉùÃ÷
http://www.5ilinux.com/lamp01.html
¹Ø¼ü×Ö£ºapache+mysql+php apache mysql php ÅäÖà lamp ·þÎñÆ÷ web
Linux+Apache+Mysql+PHPµäÐÍÅäÖÃ
µ÷ÊÔ»·¾³£ºRedhat9.0 Apache1.3.29 Mysql3.23.58 PHP4.3.4
LinuxϵͳµÄ°²×°ÎҾͲ»½²Á ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ