×î½üÔÚдһ¸ö ǰ̨»ùÓÚ javascript. µÄ¿Í»§¶Ë ·þÎñÆ÷¶ËPHP µÄ·ÖÎöϵͳ¡£
ÔÏȼƻ®Ê¹ÓÃXMLΪÊý¾Ý½»»¥»ù´¡ µ«ÊÇ×îÖÕ»¹ÊÇÑ¡ÓýÏÇáÁ¿¼¶µÄJSON×îΪÊý¾Ý½»»¥»ù´¡¡£
Ê×ÏȽéÉÜjsonµÄ¸ñʽ
json ˵¼òµ¥ÆäʵÊÇÒ»ÖÖÊý¾Ý¸ñʽ ¸ü¼òµ¥µÄ¿ÉÒÔ¿´×ö¼òµ¥µÄÊý×é¡£
ʵÀý £¨Ò»£©
<script>
var jsonArray=[
{"house":["±ðÊû","ÉÌÆ··¿","ƽ·¿"]}
,{"place":["±±¾©\","¸£½¨","ºÓÄÏ"]}
];
jsonArray=eval(jsonArray);
alert(jsonArray[0].house[1]);
</script>
ʵÀý(¶þ)
PHP¶ËÉú³Éjson¸ñʽµÄÊý¾Ý
PHPÌṩÁËÁ½¸öjsonÏà¹ØµÄº¯Êý
json_encode :²úÉújson¸ñʽÊý¾Ý
json_decode £º½âÂëjson¸ñʽÊý¾Ý ±äΪÆÕͨÊý×é
<?
$array=array(
'house'=>array('±ðÊû','ÉÌÆ··¿','ƽ·¿'),
......
×¼±¸:
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
# make
# make install
´´½¨ÍøÕ¾¸ùĿ¼
# mkdir /usr/local/lighttpd/htdocs
´´½¨ÅäÖÃÎļþ·ÅÖÃĿ¼
#mkdir /usr/local/lighttpd/etc
´´½¨ÈÕ־Ŀ¼
#mkdir /usr/local/lighttpd/logs
½«ÅäÖÃÎļþ¿½±´µ½/usr/local/lighttpd/etc
#cp doc/lighttpd.conf /usr/local/lighttpd/etc
Æô¶¯lighttpd
#/usr/local/lighttpd/sbin/lighttpd -f /usr/local/lighttpd/etc/lighttpd.conf
ÎÒÔÚ°²×°µÄʱºòÔÚerrorÈÕÖ¾³öÏÖ opening errorlog '/var/log/lighttpd/access.log
ÔÚ/var/logϽ¨Á¢lighttpdĿ¼¾Í¿ÉÒÔÁË
2 °²×° MYSQL
# tar zxvf mysql-5.0.20a.tar.gz
# cd mysql-5.0.20a
# ./configure --prefix=/usr/local/mysql
# make;make install
# grou ......
×¼±¸:
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
# make
# make install
´´½¨ÍøÕ¾¸ùĿ¼
# mkdir /usr/local/lighttpd/htdocs
´´½¨ÅäÖÃÎļþ·ÅÖÃĿ¼
#mkdir /usr/local/lighttpd/etc
´´½¨ÈÕ־Ŀ¼
#mkdir /usr/local/lighttpd/logs
½«ÅäÖÃÎļþ¿½±´µ½/usr/local/lighttpd/etc
#cp doc/lighttpd.conf /usr/local/lighttpd/etc
Æô¶¯lighttpd
#/usr/local/lighttpd/sbin/lighttpd -f /usr/local/lighttpd/etc/lighttpd.conf
ÎÒÔÚ°²×°µÄʱºòÔÚerrorÈÕÖ¾³öÏÖ opening errorlog '/var/log/lighttpd/access.log
ÔÚ/var/logϽ¨Á¢lighttpdĿ¼¾Í¿ÉÒÔÁË
2 °²×° MYSQL
# tar zxvf mysql-5.0.20a.tar.gz
# cd mysql-5.0.20a
# ./configure --prefix=/usr/local/mysql
# make;make install
# grou ......
PHPÈ¡µÃ³É¹¦µÄÒ»¸öÖ÷ÒªÔÒòÖ®Ò»ÊÇËýÓµÓдóÁ¿µÄ¿ÉÓÃÀ©Õ¹¡£web¿ª·¢ÕßÎÞÂÛÓкÎÖÖÐèÇó£¬ÕâÖÖÐèÇó×îÓпÉÄÜÔÚPHP·¢ÐаüÀïÕÒµ½¡£PHP·¢Ðаü°üÀ¨Ö§³Ö¸÷ÖÖÊý¾Ý¿â£¬Í¼ÐÎÎļþ¸ñʽ£¬Ñ¹Ëõ£¬XML¼¼ÊõÀ©Õ¹ÔÚÄÚµÄÐí¶àÀ©Õ¹¡£
¡¡¡¡À©Õ¹APIµÄÒýÈëʹPHPÈ¡µÃÁ˾޴óµÄ½øÕ¹£¬À©Õ¹API»úÖÆʹPHP¿ª·¢ÉçÇøºÜÈÝÒ׵Ŀª·¢³ö¼¸Ê®ÖÖÀ©Õ¹¡£¡£À©Õ¹Ö÷ÒªµÄ˼ÏëÊÇ£º¾¡¿ÉÄܵĴÓÀ©Õ¹±àдÕßÄÇÀïÒþ²ØPHPµÄÄÚ²¿»úÖƺͽű¾ÒýÇæ±¾Éí£¬½ö½öÐèÒª¿ª·¢ÕßÊìϤAPI¡£
¡¡¡¡ÓÐÁ½¸öÀíÓÉÐèÒª×Ô¼º±àдPHPÀ©Õ¹¡£µÚÒ»¸öÀíÓÉÊÇ£ºPHPÐèÒªÖ§³ÖÒ»ÏîËý»¹Î´Ö§³ÖµÄ¼¼Êõ¡£Õâͨ³£°üÀ¨°ü¹üһЩÏֳɵÄCº¯Êý¿â£¬ÒÔ±ãÌṩPHP½Ó¿Ú¡£ÀýÈ磬Èç¹ûÒ»¸ö½ÐFooBaseµÄÊý¾Ý¿âÒÑÍƳöÊг¡£¬ÄãÐèÒª½¨Á¢Ò»¸öPHPÀ©Õ¹°ïÖúÄã´ÓPHPÀïµ÷ÓÃFooBaseµÄCº¯Êý¿â¡£Õâ¸ö¹¤×÷¿ÉÄܽöÓÉÒ»¸öÈËÍê³É£¬È»ºó±»Õû¸öPHPÉçÇø¹²Ïí£¨Èç¹ûÄãÔ¸ÒâµÄ»°£©¡£µÚ¶þ¸ö²»ÊǺÜÆÕ±éµÄÀíÓÉÊÇ£ºÄãÐèÒª´ÓÐÔÄÜ»ò¹¦ÄܵÄÔÒò¿¼ÂÇÀ´±àдһЩÉÌÒµÂß¼¡£
¡¡¡¡Ê×ÏÈ£¬ÎÒÃÇÓ¦¸ÃÑ¡ÔñÈçºÎÈ¥¹¹½¨ÎÒÃǵÄÀ©Õ¹Ä£¿é£¬ ÓÐÈýÖÖ·½Ê½:
¡¡¡¡1. External Modules
¡¡¡¡Íⲿģ¿é£¬Ò²¾ÍÊDZàÒë³É¹²Ïí¿â£¬ÓÃdl()º¯Êý¶¯Ì¬¼ÓÔØ¡£
¡¡¡¡ºÃ´¦£º (1)²»ÐèÒªÖØбàÒë PHP (2)PHPÌå»ýС£¬ÒòΪ²»ÐèÒª±àÒë½øPHP
¡¡¡¡È±µã: (1)ÿ´Î*.php½ ......
PHPÈ¡µÃ³É¹¦µÄÒ»¸öÖ÷ÒªÔÒòÖ®Ò»ÊÇËýÓµÓдóÁ¿µÄ¿ÉÓÃÀ©Õ¹¡£web¿ª·¢ÕßÎÞÂÛÓкÎÖÖÐèÇó£¬ÕâÖÖÐèÇó×îÓпÉÄÜÔÚPHP·¢ÐаüÀïÕÒµ½¡£PHP·¢Ðаü°üÀ¨Ö§³Ö¸÷ÖÖÊý¾Ý¿â£¬Í¼ÐÎÎļþ¸ñʽ£¬Ñ¹Ëõ£¬XML¼¼ÊõÀ©Õ¹ÔÚÄÚµÄÐí¶àÀ©Õ¹¡£
¡¡¡¡À©Õ¹APIµÄÒýÈëʹPHPÈ¡µÃÁ˾޴óµÄ½øÕ¹£¬À©Õ¹API»úÖÆʹPHP¿ª·¢ÉçÇøºÜÈÝÒ׵Ŀª·¢³ö¼¸Ê®ÖÖÀ©Õ¹¡£¡£À©Õ¹Ö÷ÒªµÄ˼ÏëÊÇ£º¾¡¿ÉÄܵĴÓÀ©Õ¹±àдÕßÄÇÀïÒþ²ØPHPµÄÄÚ²¿»úÖƺͽű¾ÒýÇæ±¾Éí£¬½ö½öÐèÒª¿ª·¢ÕßÊìϤAPI¡£
¡¡¡¡ÓÐÁ½¸öÀíÓÉÐèÒª×Ô¼º±àдPHPÀ©Õ¹¡£µÚÒ»¸öÀíÓÉÊÇ£ºPHPÐèÒªÖ§³ÖÒ»ÏîËý»¹Î´Ö§³ÖµÄ¼¼Êõ¡£Õâͨ³£°üÀ¨°ü¹üһЩÏֳɵÄCº¯Êý¿â£¬ÒÔ±ãÌṩPHP½Ó¿Ú¡£ÀýÈ磬Èç¹ûÒ»¸ö½ÐFooBaseµÄÊý¾Ý¿âÒÑÍƳöÊг¡£¬ÄãÐèÒª½¨Á¢Ò»¸öPHPÀ©Õ¹°ïÖúÄã´ÓPHPÀïµ÷ÓÃFooBaseµÄCº¯Êý¿â¡£Õâ¸ö¹¤×÷¿ÉÄܽöÓÉÒ»¸öÈËÍê³É£¬È»ºó±»Õû¸öPHPÉçÇø¹²Ïí£¨Èç¹ûÄãÔ¸ÒâµÄ»°£©¡£µÚ¶þ¸ö²»ÊǺÜÆÕ±éµÄÀíÓÉÊÇ£ºÄãÐèÒª´ÓÐÔÄÜ»ò¹¦ÄܵÄÔÒò¿¼ÂÇÀ´±àдһЩÉÌÒµÂß¼¡£
¡¡¡¡Ê×ÏÈ£¬ÎÒÃÇÓ¦¸ÃÑ¡ÔñÈçºÎÈ¥¹¹½¨ÎÒÃǵÄÀ©Õ¹Ä£¿é£¬ ÓÐÈýÖÖ·½Ê½:
¡¡¡¡1. External Modules
¡¡¡¡Íⲿģ¿é£¬Ò²¾ÍÊDZàÒë³É¹²Ïí¿â£¬ÓÃdl()º¯Êý¶¯Ì¬¼ÓÔØ¡£
¡¡¡¡ºÃ´¦£º (1)²»ÐèÒªÖØбàÒë PHP (2)PHPÌå»ýС£¬ÒòΪ²»ÐèÒª±àÒë½øPHP
¡¡¡¡È±µã: (1)ÿ´Î*.php½ ......
phpÁ¬½Ómysql²âÊÔ´úÂ룺
$link=mysql_connect('localhost','root','123456');
if(!$link) echo "ʧ°Ü!";
else echo "³É¹¦!";
mysql_close();
?>
ÔËÐдúÂë³öÏÖ£ºCall to undefined function 'mysql_connect()'… ʧ°Ü
°Ù¶ÈÕÒµ½½á¹ûÊÇPHP+MYSQL »·¾³Ã»ÅäÖúÃ, php5 µÄĬÈÏ mysql ÊǹرյÄ
½«php_mysql.dllºÍlibmysql.dllÎļþ¿½±´ÖÁc:\winnt\system32ÖУ¨ÎÒ©ÁËlibmysql.dll£©
ÕÒµ½php.iniÖеÄ;extension=php_mysql,È¥µôÇ°ÃæµÄ";" ÖØÆô·þÎñÆ÷.
......
phpÁ¬½Ómysql²âÊÔ´úÂ룺
$link=mysql_connect('localhost','root','123456');
if(!$link) echo "ʧ°Ü!";
else echo "³É¹¦!";
mysql_close();
?>
ÔËÐдúÂë³öÏÖ£ºCall to undefined function 'mysql_connect()'… ʧ°Ü
°Ù¶ÈÕÒµ½½á¹ûÊÇPHP+MYSQL »·¾³Ã»ÅäÖúÃ, php5 µÄĬÈÏ mysql ÊǹرյÄ
½«php_mysql.dllºÍlibmysql.dllÎļþ¿½±´ÖÁc:\winnt\system32ÖУ¨ÎÒ©ÁËlibmysql.dll£©
ÕÒµ½php.iniÖеÄ;extension=php_mysql,È¥µôÇ°ÃæµÄ";" ÖØÆô·þÎñÆ÷.
......
ÕýÔò±í´ïʽ×Ô¼ºÒ»Ö±²»ÊìϤ£¬Õâ2ÌìÔÚÍøÉÏÒ»Ö±¿´¹ØÓÚËüµÄÎÄÕ£¬×Ô¼º×ܽáÁ˼¸¸öº¯Êý¡£
1£®preg_match()
º¯ÊýÔÐÍ£ºint preg_match (string $pattern, string $content [, array
$matches])
preg_match
()º¯ÊýÔÚ$content×Ö·û´®ÖÐËÑË÷Óë$pattern¸ø³öµÄÕýÔò±í´ïʽÏàÆ¥ÅäµÄÄÚÈÝ¡£Èç¹ûÌṩÁË$matches£¬Ôò½«Æ¥Åä½á¹û·ÅÈëÆäÖС£
$matches[0]½«°üº¬ÓëÕû¸öģʽƥÅäµÄÎı¾£¬$matches[1]½«°üº¬µÚÒ»¸ö²¶»ñµÄÓëÀ¨ºÅÖеÄģʽµ¥ÔªËùÆ¥ÅäµÄÄÚÈÝ£¬ÒÔ´ËÀàÍÆ¡£
¸Ãº¯ÊýÖ»×÷Ò»´ÎÆ¥Å䣬×îÖÕ·µ»Ø0»ò1µÄÆ¥Åä½á¹ûÊý¡£
´úÂë6.1¸ø³öpreg_match()º¯ÊýµÄÒ»¶Î´úÂëʾÀý¡£
ÈÕÆÚʱ¼äµÄÆ¥Åä
<?php
//ÐèҪƥÅäµÄ×Ö·û´®¡£dateº¯Êý·µ»Øµ±Ç°Ê±¼ä
$content = "Current date
and time is ".date("Y-m-d h:i a").", we are learning PHP
together.";
//ʹÓÃͨ³£µÄ·½·¨Æ¥Åäʱ¼ä
if
(preg_match ("/\d{4}-\d{2}-\d{2} \d{2}:\d{2} [ap]m/", $content,
$m))
{
echo "Æ¥ÅäµÄʱ¼äÊÇ£º" .$m[0].
"\n";
}
//ÓÉÓÚʱ¼äµÄģʽÃ÷ÏÔ£¬Ò²¿ÉÒÔ¼òµ¥µÄÆ¥Åä
if (preg_match
("/([\d-]{10}) ([\d:]{5} [ap]m)/", $content, $m))
......
ÒòΪֻÓÐiis6.0²Å´øÓÐwebÀ©Õ¹¡£¶øiis6.0ÊÇĬÈÏ°²×°ÔÚwin2003µÄ¡£winxpÊDz»ÄÜ°²×°iis6.0µÄ¡£ÄÇÎÒÃǾÍÓÃiis5.1°É¡£
»·¾³£ºWINXP+IIS5.1
¿ªÊ¼Ö®Ç°ÇëÏÈÈ·¶¨ÄãµÄIIS°²×°ÊÇ·ñ³É¹¦£¬ÄÜ·ñͨ¹ýhttp://localhost
À´
·ÃÎÊ
Ò»¡¢Ïȵ½PHP¹Ù·½ÍøÏÂÔظöphp-5.2.5-Win32.zip
£¬µã»÷ÕâÀïÁ´½Óµ½¹Ù
ÍøÏÂÔصØÖ·
¶þ¡¢ÏÂÔغÃÖ®ºó£¬Ö±½ÓÈ«²¿½ÓѹÖÁD:\php\
Ä¿
¼¼´¿ÉµÃPHPÎļþ´æ·ÅĿ¼D:\php\ £¨×¢£ºÕâÀïÄã¿ÉÒÔ½âѹµ½ÆäËûÅÌ£¬ÀýÈçDÅÌ»òEÅÌ£¬¿ÉÒÔ×Ô¼ºÖ¸
¶¨£¬Õâ¸ö²»Êǹؼü²½Ö裬ÕâÀïÒÔDÅÌ×÷ΪÀý×Ó
£©
Èý¡¢½«D:\PHPĿ¼ÏµÄphp.exe
¡¢php-win.exe
ºÍphp.ini-dist
Èý¸öÎļþ¿½µ½C:\Windows
£¨ Windows 2000 ÏÂΪ C:\WINNT£©Ï£»
½«C:\Windows\php.ini-dist
¸Ä
ÃûΪphp.ini
,È»ºóÓüÇʱ¾´ò¿ª£¬ÀûÓüÇʱ¾µÄ²é
ÕÒ¹¦ÄÜËÑË÷register_globals = Off
£¬
½« Off
¸Ä³É On
£¬ËÑË÷extension_dir
=
£¬²¢½«Æä·¾¶Ö¸µ½ÄãµÄ PHP Ŀ¼Ï嵀 extensions
Ŀ¼£¬±ÈÈ磺extension_dir = "D:\php\ext"
£»
½«ÒÔÏÂÄÚÈÝÇ°ÃæµÄ;
£¨×¢£º·ÖºÅ£©
È¥µô
;extension=php_dbase.dll
£¨¿É
Ñ¡£©£¬;extension=php_gd2.dll
Õâ¸öÊÇÓÃÀ´Ö§³ÖGD¿âµÄ£¬Ò»°ãÐèÒª£¬±ØÑ¡ ;extension=php_ldap. ......
×ܼǼÊý:2174; ×ÜÒ³Êý:363; ÿҳ6 Ìõ;
Ê×Ò³ ÉÏÒ»Ò³ [1] [2] [3] 4
[5] [6] [7] [8] [9] [10] ÏÂÒ»Ò³ βҳ