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

PHP»ù´¡Ñ§Ï°±Ê¼ÇÖ®»ù±¾Óï·¨

   php»ù´¡Ñ§Ï°ÒѾ­²î²»¶àÁË,µ«ÊÇΪ¼ìÑé×Ô¼ºµÄѧϰÕÆÎÕÇé¿ö,°Ñphp»ù´¡ÖªÊ¶»Ø¹Ë¸´Ï°ÁËÒ»ÏÂ
µÚÒ»¸öPHP³ÌÐò
<?php
echo "Hello World!";
?>
1 ×¢ÊÍ
1.1¶àÐÐ
/*
xxxx
*/
1.2µ¥ÐÐ
//xxxxx
2. ¸³Öµ
$a = 'test';
2.1 ¼ì²é±äÁ¿ÊÇ·ñÒÑÉùÃ÷
isset($a)
2.2 ÊͷűäÁ¿
unset($a);
2.3 ¾²Ì¬±äÁ¿
static $a;
¾²Ì¬±äÁ¿¿ÉÔÚÒ»¸öº¯Êý¼¸´Îµ÷ÓÃÖб£³ÖÊýÖµ£¬¶ø²»»á±»ÏµÍ³ÊÍ·Å£¬µ«Ö»ÄÜÔÚÉùÃ÷ËüµÄº¯Êý¼¯ÖзÃÎʵ½£¬Ö»ÄÜÔÚµÚ Ò»´ÎÉùÃ÷ʱ³õʼ»¯¡£
3. »ù±¾ÀàÐÍ
3.1 Êý×ÖÀàÐÍ
3.1.1ÕûÊý£¨integer£¬¹Ø¼ü×Öint£©
.ÕûÊý¿ÉÓÃ8½øÖÆ 10½øÖÆ 16½øÖÆ ±íʾ
$a=123; //10½øÖÆ
$b=0123; //8½øÖÆ
$c=0x123; //16½øÖÆ
. ÓÉÓÚ²Ù×÷ϵͳ²»Í¬ÕûÊý¾«¶È±ä»¯ºÜ´ó£¬µ«32λÊÇ×î³£¼ûµÄ
3.1.2¸¡µã£¨float£¬¹Ø¼ü×Öfloat£¬64λ¸¡µãÊý£¬¾«¶È14룩
.PHP ÖÐfloatºÍdoubleÊǵÈͬµÄ
.ʹÓø¡µãÊýÇмǣºËûÃÇÖ»ÊǽüËÆÖµ
È磺2.5ÔÚÄÚ²¿³£±»±íʾΪ2.499999999
ÓÖÈ磺
if(0.7+0.1>=0.8){
echo 'a';
}else{
echo 'b';
}
·µ»ØֵΪb£¬ÕâÈ¡¾öÓÚ¸¡µãÊýµÄÈ·ÇÐʵÏÖ·½Ê½£¬ÍƼö×ö·¨ÊDZÜÃâʹÓø¡µãÖµ×ö±È ½Ï
3.2 ×Ö·û´®
.Óõ¥ÒýºÅ»òË«ÒýºÅ°üΧ
È磺echo "Hello"; echo 'Hello';
.Ë«ÒýºÅÖеıäÁ¿ »á±»½âÊÍ£¬µ¥ÒýºÅÖеÄÔò²»»á
È磺var $name = 'jano';
echo "my name is $name.";//ÏÔʾ my name is jano
echo 'my name is $name'; //ÏÔʾ my name is $name
.Ë«Òý ºÅÖеıäÁ¿¿ÉÓÃ{}°üΧÀ´Çø·Ö±äÁ¿ºÍºóÃæµÄ×Öĸ
È磺var $n = "my name is {$name}Yu";//Èç¹ûûÓÐ{}¾ÍÎÞ·¨Çø·Ö±äÁ¿ºÍ×Ö·û
.heredoc
$a = <<< HTM
skjdfjsd
lksdfjsdlf
HTML; //ºóÃæµÄ±íʾ±ØÐ붥ÔÚ×îÇ°Ãæ
.»ñÈ¡×Ö·û´®ÖеÄij¸ö×Ö·û
$a = 'Hello';
echo $a{1}; // ÏÔʾe
echo $a[1]; // ÏÔʾe
ÍƼöʹÓõÚÒ»ÖÖд·¨¿ÉÒÔºÍÊý×éÇø·Ö¿ª
3.3 ²¼¶ûÖµ
true false
4.³£Óú¯Êý
. nl2br °É×Ö·û´®ÖеĻ»Ðзûת»¯³É<br />
È磺echo nl2br($a);
.var_dump
ÏÔʾ±ä Á¿ÀàÐͺÍÖµ£¬È磺var_dump($a);
.print_r
var_dump¼ÓÇ¿°æ£¬´òÓ¡¶ÔÏóÀàÐͺÍÄÚÈÝ£¬Êý×éÔò´ò³öËùÓÐÔªËØ£¬Àà¶ÔÏó Ôò´òÓ¡ËùÓгÉÔ±
È磺$a = array(1,2,3,4,5);
print_r($a);
5.Êý×é
Êý×éÓÃarray·½ ·¨ÉùÃ÷
Àý£º
$a = array('a','b','c');
$a = array('a','b',array(1,2,3));
.ĬÈÏ´ÓË÷Òý0¿ªÊ¼¸³Öµ
È磺$a[]='a'; //$a[0]='a';
$a[]='b'; //$a[1]='b';
.ʹÓÃ×Ö


Ïà¹ØÎĵµ£º

·ÖÎöPHPµÄob_start()


ÔÚPHP±à³ÌÖÐ, ÎÒÃǾ­³£»áÓöµ½Ò»Ð©Ö±½Ó²úÉúÊä³öµÄº¯Êý, Èçpassthru(),readfile(), var_dump() µÈ. µ«ÓÐʱÎÒÃÇÏë°ÑÕâЩº¯ÊýµÄÊä³öµ¼Èëµ½ÎļþÖÐ,»òÕßÏȾ­¹ý´¦ÀíÔÙÊä³ö, »òÕß°ÑÕâЩº¯ÊýµÄÊä³ö×÷Ϊ×Ö·û´®À´´¦Àí.
¡¡¡¡ÕâʱÎÒÃǾÍÒªÓõ½ Output Buffer(Êä³ö»º³å) º¯ÊýÁË.
´¦ÀíÊä³ö»º³åµÄº¯ÊýÖ÷ÒªÓÐÕâô¼¸¸ö:
ob_start() ¿ªÊ¼Ê ......

PHP ArrayʵÓú¯Êý²Î¿¼

array_flip
½»»»Êý×éÖеļüºÍÖµ
$arr1 = array('a'=>1,'b'=>2,'c'=>3,'d'=>4);
$array = array_flip($arr1);
showArr($array);
/*
Array
(
[1] => a
[2] => b
[3] => c
[4] => d
)
*/
array_key_exists
 
¼ì²é¸ø¶¨µÄ¼üÃû»òË÷ÒýÊÇ·ñ´æÔÚÓÚÊý×éÖÐ(Ò²¿ÉÓÃÓÚ¶ÔÏó ......

ת phpµÄÃæÊÔÌâ

תÔصÄPHPÃæÊÔÌâ
1. »ù±¾ÖªÊ¶µã
HTTPЭÒéÖм¸¸ö״̬ÂëµÄº¬Òå:503 500 401 200 301 302¡£¡£¡£
Include require include_once require_once µÄÇø±ð.
PHP/MysqlÖм¸¸ö°æ±¾µÄ½ø»¯Ê·£¬±ÈÈçmysql4.0µ½4.1£¬PHP 4.xµ½5.1µÄÖØ´ó¸Ä½øµÈµÈ¡£
HEREDOC½éÉÜ
д³öһЩphpħ»Ã·½·¨;
һЩ±àÒëphpʱµÄconfigure ²ÎÊý
Ïòphp´«Èë ......

ѧϰPHP»¹ÊÇÓÎÏ·¿ª·¢£¿

¡¡¡¡ËµÊµÔڵģ¬ÏÖÔÚµÄweb¿ª·¢È·ÊµºÜ»ð£¬µ«×ܾõµÃ¶ÔÎÒÀ´ËµÃ»ÓÐʲôÎüÒýÁ¦¡£Ëµµ½µ×£¬²»¹ýÊÇ×ö¸öÍøÕ¾ÂÓÐʲôÒâ˼£¿¾ÍËã×ö¸öÌÔ±¦Íø£¬ËãºÜÅ£ÁË°É£¬ÄÇÓÖÔõôÑù£¬²»¹ý¾ÍÊÇʵÏÖһЩ½»»¥²Ù×÷µÄÍøÕ¾°ÕÁË£¬×ܾõµÃ£¬Ã»Óж¯Á¦¡£
¡¡¡¡Æäʵ£¬´ÓÄÚÐÄÉî´¦£¬»¹ÊǾõµÃ×öÓÎÏ·ºÜÓÐÒâ˼¡£ÍæÓÎÏ·¸üÓÐÒâ˼£¬×ö³öƯÁÁµÄÓÎϷЧ¹û²ÅÊǷdz£Ë§µÄ¡£¾¡¹ ......

10ÌõPHP±à³ÌÏ°¹ßÖúÄãÕÒ¹¤×÷

1¡¢Ê¹Óõ¥ÒýºÅÀ¨ÆðÀ´µÄ×Ö·û´®
µ±Ê¹ÓÃË«ÒýºÅÀ´À¨×Ö·û´®Ê±£¬PHP½âÊÍÆ÷»á¶ÔÆä½øÐбäÁ¿Ìæ»»¡¢×ªÒåµÈ²Ù×÷£¬Èç
“\n”¡£Èç¹ûÖ»ÏëÊä³öÒ»¸ö»ù±¾µÄ×Ö·û´®£¬Óõ¥ÒýºÅ»á½ÚʡһЩ×ÊÔ´¡£µ±È»£¬Èç¹ûÐèÒª½øÐбäÁ¿Ìæ»»µÄ£¬ÄǾͱØÐëÓÃË«ÒýºÅÁË¡£
2¡¢×Ö·û´®µÄÊä³ö
ÒÔÏÂÄÄÒ»ÌõÓï¾äµÄÔËÐÐËÙ¶È×î¿ì£¿
print “Hi my name is ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ