phpѧϰ±Ê¼Ç£¨5£©:PHPÌõ¼þÓï¾äµÄ½éÉÜÓëÓ¦Óãº
PHPÌõ¼þÓï¾äµÄ½éÉÜÓëÓ¦ÓÃ
1¡¢if Ìõ¼þÓï¾ä
if(expr)
echo TRUE
else
echo FALSE
if(expr) {
echo TRUE
}else{
echo FALSE
}
f(expr) {
echo TRUE
}
elseif(expr) {
echo CON
}else{
echo FALSE
}
2.switch Ìõ¼þÓï¾ä
switch ($i) {
case 0:
echo "Êä³ö 0";
break;
case 1:
echo "Êä³ö 1";
break;
case 2:
echo "Êä³ö 2";
break;
}
µÈ¼ÛÓÚ£º
f ($i == 0) {
echo "Êä³ö 0";
} elseif ($i == 1) {
echo "Êä³ö 1";
} elseif ($i == 2) {
echo "Êä³ö 2";
}
ÒÔÏÂÊÇÔ´Â룺
<?php
/*
* ÿÌìÒ»µãµã£¬¾ÍÄÜѧºÃphp
* Author: CHAUVET;
* Date: 2009-12-30;
* Function: ÑÝʾÌõ¼þÓï¾ä
*/
$iNum=4;
if($iNum==4){
echo "ÕýÈ·";
}else{
echo "´íÎó";
}
print "<br/>";
$answer='A';
if($answer=='A'){
print "ÄúÑ¡ÖÐÁËA";
}elseif($answer=='B'){
print "ÄúÑ¡ÖÐÁËB";
}else if($answer=='C'){
print "ÄúÑ¡ÖÐÁËC";
}else{
print "ÄúÑ¡ÖÐÁËD";
}
print "<br/>";
#µÈ¼ÛÓÚ
switch($answer){
case 'A':
echo "ÄúÑ¡ÖÐÁËA";
break;
case 'B':
echo "ÄúÑ¡ÖÐÁËB";
break;
case 'C':
echo "ÄúÑ¡ÖÐÁËC";
break;
case'D':
echo "ÄúÑ¡ÖÐÁËD";
break;
default:
echo "ÄúûÓÐÑ¡ÖÐÈκζ«Î÷";
}
print '<br/>
Ïà¹ØÎĵµ£º
££££££££££££££
°²×°pear
££££££££££££££
pearÊÇPHPµÄÀ©Õ¹ºÍÓ¦ÓóÌÐò¿â£¬°üº¬Á˺ܶàÓÐÓõÄÀ࣬°²×°ºÃphp5.0ºó£¬pearʵ¼ÊÉϲ¢Ã»Óб»°²×°£¬°²×°µÄ·½·¨ÈçÏ£º
1.ÔÚphpĿ¼ÖÐË«»÷go-pear.bat¡£
2.°´ÕÕÌáʾÊäÈëһЩÉèÖÃÐÅÏ¢£¬ ......
ÓÉÓÚÄêÇ°°Ñ¹¤×÷È·ÈÏÏÂÀ´ÁË£¬ÓÚÊÇ×¼±¸ÀûÓÃ׫д±ÏÒµÂÛÎĵÄÆÚ¼äѧϰһÏÂPHPµÄ¿ª·¢£¬ÈκÎÒ»ÃÅÓïÑÔµÄѧϰ¹ý³Ì£¬µÚÒ»²½¶¼ÊÇ¿ª·¢»·¾³µÄ³É¹¦ÅäÖã¬ÓÚÊÇÎÒ»¨ÁËÒ»ÉÏÎçʱ¼ä°Ñ»·¾³´î½¨³É¹¦¡£
PHP¿ª·¢»·¾³ÅäÖùý³ÌÏê½â
±¾´ÎÅäÖÃÖ÷ÒªÕë¶ÔÓÚWindows XPϵÄÅäÖð²×°£¬ÖÁÓÚLinuxϵÄÅäÖð²×°½«ÔÚÒÔºó¸øÓè²¹³ä¡£
Ò»¡¢ËùÐèÈí¼þ
Windows XP ......
Ïȸø´ó¼ÒÌùÒ»¸öʵÀý
test.php
<?php
//°üº¬seppageÀàÎļþ
require 'seppage.class.php';
//µ±Ç°Ò³Âë
$pagenow=2;
//Ò³Ãæ×ÜÊý
$pageall=10;
/*
*ÐèÒª·ÖÒ³µÄURLµØÖ·£¬¿ÉÒÔURLÖпÉÒÔ×ÔÓÉʹÓÃ?ºÅ»òÕß&ºÅ£¬³ÌÐò»á×Ô¶¯Ê¶±ð
*´Ë²ÎÊýºÍ$modurl²ÎÊýÉèÖÃÒ»Ïî¼´¿É£¬ÈôÁ½ÏÓУ¬Ôò°´$modurlΪ׼
*/
$url='http://l ......
×î½üÒ»Ö±ÔÚ×ö×Ô¼ºµÄͼÊéÕ¾£¬·Ö±ðʹÓùý½ÜÆæºÍ¶Á°ÉÁ½Ìײ»Í¬µÄϵͳ£¬¶ÔÓÚÕâÁ½Ì×ϵͳҲÊÇÓÖ°®ÓÖºÞ£¬°®µÄÊÇËûÃǵŦÄÜÇ¿´ó£¬ºÞËûÃǶ¼Í¬ÊôûÓпªÔ´¾«ÉñµÄ²úÎï¡£ºÇºÇ£¬×÷ΪһÃûÇî³ÌÐòÔ±£¬°³¿ÉÒÔÀí½â×÷ÕߵĿàÖÔ£¬ÕâÀï¾Í²»ÅúÅÐÁË¡£
Äê¼ÙÆڼ䣬ÎÞÊ¿É×ö£¬·¿´×Ô¼ºÒÔÇ°µÄ²É¼¯´úÂ룬·¢Ïֺܶà¿ÉÒÔÓÅ»¯ºÍÌáÉýµÄµØ·½£¬¾Í¼òµ¥×öÁËÏÂÓÅ» ......
{Ò»}PHPÖÐthis,self,parentµÄÇø±ðÖ®Ò»thisƪ
ÃæÏò¶ÔÏó±à³Ì(OOP,Object Oriented Programming)ÏÖÒѾ³ÉΪ±à³ÌÈËÔ±µÄÒ»Ïî»ù±¾¼¼ÄÜ¡£ÀûÓÃOOPµÄ˼Ïë½øÐÐPHPµÄ¸ß¼¶±à³Ì£¬¶ÔÓÚÌá¸ßPHP±à³ÌÄÜÁ¦ºÍ¹æ»®web¿ª·¢¹¹¼Ü¶¼ÊǺÜÓÐÒâÒåµÄ¡£
PHP5¾¹ýÖØдºó£¬¶ÔOOPµÄÖ§³Ö¶îÓÐÁ˺ܴóµÄ·ÉÔ¾£¬³ÉΪÁ˾߱¸ ......