PHP»ù´¡
1. »ù´¡Óï·¨
PHP µÄ½Å±¾¿éÒÔ <?php ¿ªÊ¼£¬ÒÔ ?> ½áÊø¡£Äú¿ÉÒÔ°Ñ PHP µÄ½Å±¾¿é·ÅÖÃÔÚÎĵµÖеÄÈκÎλÖá£
PHP ÖеÄÿ¸ö´úÂëÐж¼±ØÐëÒԷֺŽáÊø¡£·ÖºÅÊÇÒ»ÖÖ·Ö¸ô·û£¬ÓÃÓÚ°ÑÖ¸ÁÇø·Ö¿ªÀ´¡£
ÓÐÁ½ÖÖͨ¹ý PHP À´Êä³öÎı¾µÄ»ù´¡Ö¸Áecho ºÍ print¡£ÔÚÉÏÃæµÄÀý×ÓÖУ¬ÎÒÃÇʹÓÃÁË echo Óï¾äÀ´Êä³öÎı¾ "Hello World"¡£
ÔÚ PHP ÖУ¬ÎÒÃÇʹÓà // À´±àдµ¥ÐÐ×¢ÊÍ£¬»òÕßʹÓà /* ºÍ */ À´±àд´óµÄ×¢ÊÍ¿é¡£
Àý£º
<html>
<body>
<?php
echo "hello world!";
//This is a comment
/*
This is
a comment
block
*/
?>
</body>
</html>
2.PHP±äÁ¿
PHP ÖеÄËùÓбäÁ¿¶¼ÊÇÒÔ $ ·ûºÅ¿ªÊ¼µÄ¡£
ÔÚ PHP ÖÐÉèÖñäÁ¿µÄÕýÈ··½·¨ÊÇ£º$var_name = value;
PHP ÊÇÒ»ÃÅËÉÉ¢ÀàÐ͵ÄÓïÑÔ£¨Loosely Typed Language£©,javascriptÒ²ÊÇÈõÀàÐÍ£¬Ïà·´JavaÊÇÇ¿ÀàÐ͵Ä
±äÁ¿µÄÃüÃû¹æÔò
±äÁ¿Ãû±ØÐëÒÔ×Öĸ»òÏ»®Ïß "_" ¿ªÍ·¡£
±äÁ¿ÃûÖ»ÄÜ°üº¬×ÖĸÊý×Ö×Ö·ûÒÔ¼°Ï»®Ïß¡£
±äÁ¿Ãû²»ÄÜ°üº¬¿Õ¸ñ¡£Èç¹û±äÁ¿ÃûÓɶà¸öµ¥´Ê×é³É£¬ÄÇôӦ¸ÃʹÓÃÏ»®Ïß½øÐзָô£¨±ÈÈç $my_string£©£¬»òÕßÒÔ´óд×Öĸ¿ªÍ·£¨±ÈÈç $myString£©¡£
3.PHP×Ö·û´®
²¢ÖòÙ×÷·û(concat), ¼´µãºÅ²Ù×÷·û
Àý£º
<? php
$my_string = "zdxue"
echo $my_string . " " . "nihao!"
?>
Ò³ÃæÏÔʾ£ºzdxue nihao!
strlen() Çó×Ö·û´®³¤¶È
strpos() ÕÒ×Ö·û´®ÖÐij×Ö·ûλÖÃ
ÆäËü¹ØÓÚPHPÖÐ×Ö·û´®µÄAPI£¬¿ÉÒÔ²éÔÄPHP¿ª·¢ÊÖ²á
4.
ÔËËã·û¡¢Ìõ¼þ·ÖÖ§¡¢Ñ»·£¨Ìø¹ý£©
5.PHPÊý×é
1.ÊýÖµÊý×é
$names=array("zdxue","brucelee");
$names[0]
$names[1]
2.¹ØÁªÊý×é
$ages=array("zdxue"=>24, "brucelee"=>69);
$ages["zdxue"] = 24;
3.¶àάÊý×é
$families=array(
"zdxue"=>array(
"zdxue",
"qyang"
"little"
),
"brucelee"=>array(
"bruce",
"linda"
)
);
________________________________________________________________________________________
º¯Êý -- PHPº¯ÊýºÍJSº¯ÊýºÜÀ×ͬ:)
PHP×Ô´øº¯Êý¿âAPI£¬²ÎÔÄÊֲἴ¿É
×Ô¶¨ÒåPHPº¯Êý£º
1¡£ËùÓеĺ¯Êý¶¼Ê¹Óùؼü´Ê "function()" À´¿ªÊ¼
2¡£ÃüÃûº¯Êý - º¯ÊýµÄÃû³ÆÓ¦¸ÃÌáʾ³öËüµÄ¹¦ÄÜ¡£º¯ÊýÃû³ÆÒÔ×Öĸ»òÏ»®Ïß¿ªÍ·¡£
3¡£Ìí¼Ó "{" - ¿ª¿ÚµÄ»¨À¨ºÅÖ®ºóµÄ²¿·ÖÊǺ¯ÊýµÄ´úÂë¡£
4¡£²åÈ
Ïà¹ØÎĵµ£º
×î½üÔÚдһ¸ö ǰ̨»ùÓÚ javascript. µÄ¿Í»§¶Ë ·þÎñÆ÷¶ËPHP µÄ·ÖÎöϵͳ¡£
ÔÏȼƻ®Ê¹ÓÃXMLΪÊý¾Ý½»»¥»ù´¡ µ«ÊÇ×îÖÕ»¹ÊÇÑ¡ÓýÏÇáÁ¿¼¶µÄJSON×îΪÊý¾Ý½»»¥»ù´¡¡£
Ê×ÏȽéÉÜjsonµÄ¸ñʽ
json ˵¼òµ¥ÆäʵÊÇÒ»ÖÖÊý¾Ý¸ñʽ ¸ü¼òµ¥µÄ¿ÉÒÔ¿´×ö¼òµ¥µÄÊý×é¡£
ʵÀý £¨Ò»£©
<script>
var jsonArray=[
......
×¼±¸:
lighttpd-1.4.15.tar.gz
php-4.4.2.tar.gz
mysql-5.0.20a.tar.gz
¿ªÊ¼:
1 ±àÒë°²×°lighttpd
# tar zxvf lighttpd-1.4.15.tar.gz
# cd lighttpd-1.4.15
# ls
# ./configure --prefix=/usr/local/lighttpd //´Ë²¿ÎÞ·¨±àÒëʱÌáʾ°²×°prce-devel
#&nbs ......
JavaÖеÄstartsWithºÍendsWith·½·¨£¬ÔÚfilterµÄ¹¦ÄÜʵÏÖÖкܷ½±ã£¬PHP¿ÉÒÔÓÃstrncmp()
ʵÏÖstartsWith£¬µ«ÊÇÎÞ·¨ÊµÏÖendsWith£¬ÓÐЩÈË»áÓÃÕýÔòÀ´ÊµÏÖ£¬µ«´ó¶àÊýÈ˶¼²»Ï²»¶ÕýÔò±í´ïʽµÄ²Ù×÷¡£
ÕâÀïÎÒͨ¹ýÒ»¸ö½Ðsubstr_compareµÄ·½·¨ÊµÏÖ(ͬʱËûÒ²ÄÜʵÏÖsta ......
Apache °æ±¾£º 2.2
PHP °æ±¾£º5.2.11
EclipseÏÂÔصØÖ·£ºhttp://downloads.zend.com/pdt/all-in-one/zend-eclipse-php-galileo-SR1-win32-x86.zip
½âѹºóÔËÐÐEclipse.exe
Ñ¡Ôñ¹¤×÷¿Õ¼ä
ÎÒÑ¡ÔñÁËE:\PHPworkspace
ÕâʱҪ²åÈëÒ»²½
´ò¿ªApacheµÄÅäÖÃÎļþhttpd.conf
²éÕÒ”DocumentRoot“
ÐÞ¸ÄdocumentrootµÄÖ ......