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

PHP»ù±¾Óï·¨£¨Èý£©—— IFÌõ¼þÓï¾ä

If...Else Óï¾ä
if¡¢elseif ÒÔ¼° else Óï¾äÓÃÓÚÖ´ÐлùÓÚ²»Í¬Ìõ¼þµÄ²»Í¬¶¯×÷¡£µ±Äú±àд´úÂëʱ£¬Äú³£³£ÐèҪΪ²»Í¬µÄÅжÏÖ´Ðв»Í¬µÄ¶¯×÷¡£Äú¿ÉÒÔÔÚ´úÂëÖÐʹÓÃÌõ¼þÓï¾äÀ´Íê³É´ËÈÎÎñ£º
if...else Óï¾ä
    ÔÚÌõ¼þ³ÉÁ¢Ê±Ö´ÐÐÒ»¿é´úÂ룬Ìõ¼þ²»³ÉÁ¢Ê±Ö´ÐÐÁíÒ»¿é´úÂë
elseif Óï¾ä
    Óë if...else ÅäºÏʹÓã¬ÔÚÈô¸ÉÌõ¼þÖ®Ò»³ÉÁ¢Ê±Ö´ÐÐÒ»¸ö´úÂë¿é
 
If...Else Óï¾ä
Èç¹ûÄúÏ£ÍûÔÚij¸öÌõ¼þ³ÉÁ¢Ê±Ö´ÐÐһЩ´úÂ룬ÔÚÌõ¼þ²»³ÉÁ¢Ê±Ö´ÐÐÁíһЩ´úÂ룬ÇëʹÓà if....else Óï¾ä¡£
Óï·¨£º
if (condition)
  code to be executed if condition is true;
else
  code to be executed if condition is false;
ʵÀý£º
Èç¹ûµ±Ç°ÈÕÆÚÊÇÖÜÎ壬ÏÂÃæµÄ´úÂ뽫Êä³ö "Have a nice weekend!"£¬·ñÔò»áÊä³ö "Have a nice day!"£º
<html>
<body>
<?php
$d=date("D");
if ($d=="Fri")
  echo "Have a nice weekend!";
else
  echo "Have a nice day!";
?>
</body>
</html>
 
Èç¹ûÐèÒªÔÚÌõ¼þ³ÉÁ¢»ò²»³ÉÁ¢Ê±Ö´ÐжàÐдúÂ룬Ӧ¸Ã°ÑÕâЩ´úÂëÐаüÀ¨ÔÚ»¨À¨ºÅÖУº
<html>
<body>
<?php
$d=date("D");
if ($d=="Fri")
  {
  echo "Hello!<br />";
  echo "Have a nice weekend!";
  echo "See you on Monday!";
  }
?>
</body>
</html>
 
ElseIf Óï¾ä
Èç¹ûÏ£ÍûÔÚ¶à¸öÌõ¼þÖ®Ò»³ÉÁ¢Ê±Ö´ÐдúÂ룬ÇëʹÓà elseif Óï¾ä£º
Óï·¨£º
if (condition)
  code to be executed if condition is true;
elseif (condition)
  code to be executed if condition is true;
else
  code to be executed if condition is false;
 
ʵÀý£º
Èç¹ûµ±Ç°ÈÕÆÚÊÇÖÜÎ壬ÏÂÃæµÄÀý×Ó»áÊä³ö "Have a nice weekend!"£¬Èç¹ûÊÇÖÜÈÕ£¬ÔòÊä³ö "Have a nice Sunday!"£¬·ñÔòÊä³ö "Have a nice day!"£º
<html>
<body>
<?php
$d=date("D");
if ($d=="Fri")
  echo "Have a nice weekend!";
elseif ($d=="Sun")
  echo "Have a nice Sunday!";
else
  echo "Have a nice day!";
?>
</body>
</html>
 


Ïà¹ØÎĵµ£º

PHPʵÏÖhttpÓëhttpsµÄת»¯

http://blog.s135.com/read.php/142.htm
¡¡¡¡×î½üÔÚдPHP³ÌÐòʱ£¬ÐèҪʹä¯ÀÀÆ÷ÔÚhttpsºÍhttpÖ®¼äת»¯£¬ÉÏÍøËÑË÷Ïà¹ØÐÅÏ¢£¬ÎÞÄÎÖ»ÓÐ×î½üÔÚдPHP³ÌÐòʱ£¬ÐèҪʹä¯ÀÀÆ÷ÔÚhttpsºÍhttpÖ®¼äת»¯£¬ÉÏÍøËÑË÷Ïà¹ØÐÅÏ¢£¬ÎÞÄÎÖ»ÓÐһƪ½éÉÜÓÃASPʵÏÖ“ÔÚhttpºÍhttpsÖ®¼äת»¯”µÄÎÄÕ£¬ÓÚÊÇÖ»ºÃÐÐдÁËÓÃPHPʵÏÖhttpÓëhttpsת» ......

php¼ÓÈëlinuxϵͳÃüÁî


¼ÙÉèphp°²×°ÔÚ/usr/local/php5/bin/php£¬³õʼÔÚÃüÁîÐÐÖ´ÐÐPHPµÄʱºòÒªÊäÈëÒ»³¤´®µÄ·¾¶£¬eg£º
$>/usr/local/php5/bin/php phpinfo.php
·Ç³£µÄÂé·³£¬ÏÖÔÚÖ»Ð轫php¿½±´ÖÁusr/sbinĿ¼¼´¿ÉÖ±½ÓʹÓÃphpÃüÁeg£º
$>cp /usr/local/php5/bin/php /usr/sbin/
$>php phpinfo.php
......

PHP²¿·Ö³£¼ûËã·¨


//1. Óû§ÃÜÂëÁùλÊý,²»ÄÜ´óÓÚÁùλ¶ø²»ÄÜСÓÚÁùÊý,Êý×ÖÖµÕýÔòΪ[0-9],ÇëÓÃPHPд³öÓм¸ÖÖ¿ÉÄÜÐÔ,²¢×ö±©Á¦Æƽâ;
function dePassword($pwd) {
$tmp = array('000000', '555555', '999999');
for ($i = 0; $i < 3; $i++) {
if ($pwd == $tmp[$i]) return $tmp[$i];
}
return $pwd < $tmp[1] ? getPwd(0, $pwd ......

PHP»ù±¾Óï·¨£¨Ò»£©—— ±äÁ¿

1 ¿ªÊ¼Ð´PHP³ÌÐò
¸úѧC/C++¡¢javaÒ»Ñù£¬ÎÒÃÇÏÈ´Óhello world¿ªÊ¼£º
PHP µÄ½Å±¾¿éÒÔ <?php ¿ªÊ¼£¬ÒÔ ?> ½áÊø¡£Äú¿ÉÒÔ°Ñ PHP µÄ½Å±¾¿é·ÅÖÃÔÚhtmlÎĵµÖеÄÈκÎλÖᣵ±È»£¬ÔÚÖ§³Ö¼òдµÄ·þÎñÆ÷ÉÏ£¬Äú¿ÉÒÔʹÓà <? ºÍ ?> À´¿ªÊ¼ºÍ½áÊø½Å±¾¿é¡£²»¹ý£¬ÎªÁË´ïµ½×îºÃµÄ¼æÈÝÐÔ£¬ÎÒÃÇÍƼöÄúʹÓñê×¼ÐÎʽ£¨ <?php£© £¬¶ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ