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

PHP»ù±¾Óï·¨£¨Áù£©—— Êý×é

Êý×é
ÔÚʹÓà PHP ½øÐпª·¢µÄ¹ý³ÌÖУ¬»òÔç»òÍí£¬Äú»áÐèÒª´´½¨Ðí¶àÏàËƵıäÁ¿¡£ÎÞÐèºÜ¶àÏàËƵıäÁ¿£¬Äã¿ÉÒÔ°ÑÊý¾Ý×÷ΪԪËØ´æ´¢ÔÚÊý×éÖС£Êý×éÖеÄÔªËض¼ÓÐ×Ô¼ºµÄ ID£¬Òò´Ë¿ÉÒÔ·½±ãµØ·ÃÎÊËüÃÇ¡£
ÓÐÈýÖÖÊý×éÀàÐÍ£º
ÊýÖµÊý×é
´øÓÐÊý×Ö ID ¼üµÄÊý×é
¹ØÁªÊý×é
Êý×éÖеÄÿ¸ö ID ¼ü¹ØÁªÒ»¸öÖµ
¶àάÊý×é
°üº¬Ò»¸ö»ò¶à¸öÊý×éµÄÊý×é
Ò»¡¢ÊýÖµÊý×é
ÊýÖµÊý×é´æ´¢µÄÿ¸öÔªËض¼´øÓÐÒ»¸öÊý×Ö ID ¼ü¡£¿ÉÒÔʹÓò»Í¬µÄ·½·¨À´´´½¨ÊýÖµÊý×飺
Àý×Ó 1£º
ÔÚÕâ¸öÀý×ÓÖУ¬»á×Ô¶¯·ÖÅä ID ¼ü£º
$names = array("Peter","Quagmire","Joe");
Àý×Ó 2
ÔÚÕâ¸öÀý×ÓÖУ¬ÎÒÃÇÈ˹¤·ÖÅäµÄ ID ¼ü£º
$names[0] = "Peter";
$names[1] = "Quagmire";
$names[2] = "Joe";
¿ÉÒÔÔڽű¾ÖÐʹÓÃÕâЩ ID ¼ü£º
<?php
 
$names[0] = "Peter";
$names[1] = "Quagmire";
$names[2] = "Joe";
 
echo $names[1] . " and " . $names[2] . " are ". $names[0] . "'s neighbors";
?>
 
ÒÔÉÏ´úÂëµÄÊä³ö£º
Quagmire and Joe are Peter's neighbors
¶þ¡¢¹ØÁªÊý×é
¹ØÁªÊý×飬ËüµÄÿ¸ö ID ¼ü¶¼¹ØÁªÒ»¸öÖµ¡£ÔÚ´æ´¢ÓйؾßÌåÃüÃûµÄÖµµÄÊý¾Ýʱ£¬Ê¹ÓÃÊýÖµÊý×é²»ÊÇ×îºÃµÄ×ö·¨¡£Í¨¹ý¹ØÁªÊý×飬ÎÒÃÇ¿ÉÒÔ°ÑÖµ×÷Ϊ¼ü£¬²¢ÏòËüÃǸ³Öµ¡£
Àý×Ó 1
ÔÚ±¾ÀýÖУ¬ÎÒÃÇʹÓÃÒ»¸öÊý×é°ÑÄêÁä·ÖÅä¸ø²»Í¬µÄÈË£º
$ages = array("Peter"=>32, "Quagmire"=>30, "Joe"=>34);
Àý×Ó 2
±¾ÀýÓëÀý×Ó 1 Ïàͬ£¬²»¹ýչʾÁËÁíÒ»ÖÖ´´½¨Êý×éµÄ·½·¨£º
$ages['Peter'] = "32";
$ages['Quagmire'] = "30";
$ages['Joe'] = "34";
¿ÉÒÔÔڽű¾ÖÐʹÓà ID ¼ü£º
<?php
$ages['Peter'] = "32";
$ages['Quagmire'] = "30";
$ages['Joe'] = "34";
echo "Peter is " . $ages['Peter'] . " years old.";
?>
ÒÔÉϽű¾µÄÊä³ö£º
Peter is 32 years old.
Èý¡¢¶àάÊý×é
ÔÚ¶àάÊý×éÖУ¬Ö÷Êý×éÖеÄÿ¸öÔªËØÒ²ÊÇÒ»¸öÊý×é¡£ÔÚ×ÓÊý×éÖеÄÿ¸öÔªËØÒ²¿ÉÒÔÊÇÊý×飬ÒÔ´ËÀàÍÆ¡£
Àý×Ó 1
ÔÚ±¾ÀýÖУ¬ÎÒÃÇ´´½¨ÁËÒ»¸ö´øÓÐ×Ô¶¯·ÖÅäµÄ ID ¼üµÄ¶àάÊý×飺
$families = array
(
  "Griffin"=>array
  (
  "Peter",
  "Lois",
  "Megan"
  ),
  "Quagmire"=>array
  (
  "Glenn"
  ),
  "Brown"=>array
  (
  "Cleveland",
  "Loretta",
  "Junior"
  )
);
Èç¹ûÊä³öÕâ¸öÊý×éµÄ»°£¬Ó¦¸ÃÀàËÆÕâÑ


Ïà¹ØÎĵµ£º

PHP——Á÷³Ì¿ØÖÆÓï¾ä


Ô­ÎÄÁ´½Ó£ºhttp://www.phpdo.net/index.php/2010/01/30/1-6/
²»ÂÛÊÇPHP»¹ÊDZðµÄÓï·¨£¬³ÌÐò×ÜÊÇÓÉÈô¸ÉÌõÓï¾ä×é³É¡£
´ÓÖ´Ðз½Ê½ÉÏ¿´£¬Óï¾äµÄ¿ØÖƽṹ·ÖΪÒÔÏÂÈýÖÖ£º
1¡¢  Ë³Ðò½á¹¹£º´ÓµÚÒ»ÌõÓï¾äµ½×îºóÒ»ÌõÓï¾äÍêȫ˳ÐòÖ´ÐУ»
2¡¢  Ñ¡Ôñ½á¹¹£º¸ù¾ÝÓû§ÊäÈë»òÓï¾äµÄÖмä½á¹ûÈ¥Ö´ÐÐÈô¸ÉÈÎÎñ£»
3¡¢&n ......

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»ù±¾Óï·¨£¨Èý£©—— IFÌõ¼þÓï¾ä

If...Else Óï¾ä
if¡¢elseif ÒÔ¼° else Óï¾äÓÃÓÚÖ´ÐлùÓÚ²»Í¬Ìõ¼þµÄ²»Í¬¶¯×÷¡£µ±Äú±àд´úÂëʱ£¬Äú³£³£ÐèҪΪ²»Í¬µÄÅжÏÖ´Ðв»Í¬µÄ¶¯×÷¡£Äú¿ÉÒÔÔÚ´úÂëÖÐʹÓÃÌõ¼þÓï¾äÀ´Íê³É´ËÈÎÎñ£º
if...else Óï¾ä
    ÔÚÌõ¼þ³ÉÁ¢Ê±Ö´ÐÐÒ»¿é´úÂ룬Ìõ¼þ²»³ÉÁ¢Ê±Ö´ÐÐÁíÒ»¿é´úÂë
elseif Óï¾ä
    Óë if...el ......

PHP»ù±¾Óï·¨£¨Î壩—— Ñ­»·Óï¾ä

Ñ­»·Óï¾ä
ÔÚÄú±àд´úÂëʱ£¬Äú¾­³£ÐèÒªÈÃÏàͬµÄ´úÂë¿éÔËÐкܶà´Î¡£Äú¿ÉÒÔÔÚ´úÂëÖÐʹÓÃÑ­»·Óï¾äÀ´Íê³ÉÕâ¸öÈÎÎñ¡£
ÔÚ PHP ÖУ¬ÎÒÃÇ¿ÉÒÔʹÓÃÏÂÁÐÑ­»·Óï¾ä£º
while
Ö»ÒªÖ¸¶¨µÄÌõ¼þ³ÉÁ¢£¬ÔòÑ­»·Ö´ÐдúÂë¿é
do...while
Ê×ÏÈÖ´ÐÐÒ»´Î´úÂë¿é£¬È»ºóÔÚÖ¸¶¨µÄÌõ¼þ³ÉÁ¢Ê±Öظ´Õâ¸öÑ­»·
for
Ñ­»·Ö´ÐдúÂë¿éÖ¸¶¨µÄ´ÎÊý
foreach
¸ù ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ