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

phpѧϰ±Ê¼Ç£¨7£©:PHPÊý×éµÄ´´½¨ÐÞ¸ÄʹÓÃ

1¡¢´´½¨ ºÍ Ð޸ĠÊý×é
PHPÖÐʹÓÃarrayÀ´´´½¨Ò»¸öÊý×飺
      array( key=>value ,  key=>value …… )
Àý×Ó£º
         $arr = array (3,5,7,9,6);
         $arr = array ("id"=>2,"title"=>3);
Ó÷½À¨ºÅµÄÓï·¨À´ÐÞ¸ÄÊý×é  £º $arr[] = value
$arr = array("a" => "ÊÓƵ", "b"=>"½Ì³Ì", "c" => "y");
$arr['a']    = "PHP;
$arr['c']    = "Ìؼ­";
2¡¢Êý×éÓëÊý×éµÄº¯Êý
ʹÓàcount º¯Êýͳ¼ÆÊý×éÌõÊý count($ary)
ʹÓàis_arrayº¯ÊýÅжÏÊý×é is_array($ary)
ÁíÒ»ÖÖ´´½¨Êý×éµÄº¯Êýexplode explode("key",value)
3.ʹÓÃforeach ±éÀúÊý×é
±éÀúÊý×éºÜ¶àÖÖ·½·¨£¬¿ÉÒÔʹÓàForÑ­»·£¬whileÑ­»·£¬×îÇÉÃîµÄ
Ò»ÖÖ±éÀúÊý×éforeach¸øÎÒÃÇ´øÀ´Á˸ú¶à·½±ã
foreach ( $arr as $key => $value  ){
       ……
 }
Ô´Â룺
<?php
/*
* Author:CHAUVET
* Date:2009-12-31
* Function:ÑÝʾÊý×é
*/
setcookie("TMCookie",'www.mrbccd.com');
setcookie("TMCookie", 'www.mrbccd.com', time()+60); //ÉèÖÃcookieÓÐЧʱ¼äΪ60Ãë
//ÉèÖÃÓÐЧʱ¼äΪ60Ã룬ÓÐЧĿ¼Ϊ"AAAAA",ÓÐЧÓòÃûΪ“mrbccd.com”¼°ÆäËùÓÐ×ÓÓòÃû
setcookie("TMCookie", $value, time()+3600, "/AAAAA/",". mrbccd.com", 1);
#Àý×Ó£º
if(!isset($_COOKIE["visttime"])){//Èç¹ûcookie²»´æÔÚ
setcookie("visttime",date("y-m-d H:i:s"));//Ìí¼Ó¸Ãcookie
echo "»¶Ó­ÄúµÚÒ»´Î·ÃÎÊÍøÕ¾£¡"."<br/>";
}else{
setcookie("visttime",date("y-m-d H:i:s"),time()+60);//ÉèÖôøʧЧʱ¼äµÄ±äÁ¿
echo "ÄúÉϴηÃÎÊÍøÕ¾µÄʱ¼äΪ£º".$_COOKIE["visttime"]."<br/>";//Êä³öÉϴηÃÎÊÍøÕ¾µÄʱ¼ä
}
echo "Äú±¾´Î·ÃÎÊÍøÕ¾µÄʱ¼äΪ£º".date("y-m-d H:i:s");//Êä³öµ±Ç°Ê±¼ä
?>
<meta http-equiv="Content-Type"


Ïà¹ØÎĵµ£º

phpѧϰ±Ê¼Ç£¨2£©

phpÅäÖÃÌ«¸´ÔÓÁË,×òÌìÍíÉÏÅäÖÃÁË°ëÌ컹ûÓгɹ¦!²»µÃ²»Ñ°Çó¸ü¼òµ¥µÄ½â¾ö·½·¨:WampServer 5 ¼¯³É»·¾³
Wamp5ÊÇApache+PHP+Mysql ÔÚWindowsϵļ¯³É»·¾³£¬ÓµÓмòµ¥µÄͼÐκÍ
²Ëµ¥°²×°¡£¸Ã°æ±¾¼¯³ÉÁËPHP5.2.5 Mysql5 Apache2 phpMyAdmin 2.11.2.1
SQLiteManager 1.2.0 ÂúÁ˴󲿷ÖPHPerµÄÐèÇó.
´ÓÓï·¨ÉÏ¿´£¬PHPÓïÑÔ½üËÆÓÚCÓï ......

phpѧϰ±Ê¼Ç£¨5£©:PHPÌõ¼þÓï¾äµÄ½éÉÜÓëÓ¦Óãº


PHPÌõ¼þÓï¾äµÄ½éÉÜÓëÓ¦ÓÃ
1¡¢if Ìõ¼þÓï¾ä
if(expr)
    echo TRUE
else
    echo FALSE
if(expr) {
    echo TRUE
}else{
    echo FALSE
}
f(expr) {
    echo&n ......

PHPÖÐÕýÔò±í´ïʽµÄʹÓ÷½·¨[±Ê¼Ç]

ÔÚѧϰphpʱ£¬¿´µ½µÄ£¬×ö¸ö±Ê¼Ç
×Ö·û´®Í·²¿£º^
<?php echo ereg(“^hello”,”hello world!”); ?>
 
×Ö·û´®Î²²¿£º$
<?php echo ereg(“bye$”,”goodbye”); ?>
 
ÈÎÒâµÄµ¥¸ö×Ö·û£º.
<?php echo ereg(“.”,”goodbye”); ......

phpʵÏÖ×¢Ê͵Äɾ³ý¡¾Ö§³Ö//£¬/*£¬/**¡¿

<?php
 $fileName="function.js";
 $file=fopen($fileName,"r");
 
 $writeStr="";
 $flag=false;//ÅжÏÊÇ·ñÓÐ/***/±ê×¼
 while($strLine=fgets($file))
 {
  if(stripos($strLine,"/*")===false || stripos($strLine,"/**")===false)
  {
 &nbs ......

PHP±ÈASPÓÅÐãµÄÆ߸öÀíÓÉ ÄÏÈý·½

ASPÊÇ΢Èí¹«Ë¾ÊµÏÖ¶¯Ì¬ÍøÒ³µÄÒ»ÖÖ¼¼Êõ¡£
ASPÖ§³ÖһЩ½Å±¾ÓïÑÔ£¬Ö÷ÒªÒÔVBScriptΪÖ÷¡£
ÓëASPÏà±È½Ï£¬Ä㻹¿ÉÒÔÑ¡ÔñÁíÒ»Öпª·ÅÔ´´úÂë±à³ÌÓïÑÔ——PHP£¬PHP¿ÉÒÔÔËÐÐÔÚ¶àÖÖ²Ù×÷ϵͳÏ£¬ÆäÖаüÀ¨LinuxºÍwindows¡£
ËäÈ»ASPÊÇÒ»ÖÖ²»´íµÄ¼¼Êõ£¬µ«´Ó³¤Ô¶¿¼ÂÇÎÒÏàÐÅPHPÔÚ½«À´µÄ¼¼ÊõÁìÓòÀï»áÓв»·²µÄ±íÏÖ¡£
ÎÒÈÏΪÓÐÆ߸ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ