Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : php

PHPÈëÃÅ


dz̸PHPÓï·¨(1)
¡¡¡¡ÔÚÄãѧ¹ý»ù±¾µÄHTMLÓï·¨,¾Í¿ÉÒÔ±à³öÒ»¸ö¾²Ì¬µÄWebÒ³£¬¿É¶¯Ì¬½»»¥ÐÅÏ¢ÊǺÜÖØÒªµÄ¡£ÈçһЩÍøÕ¾µÄ»áÔ±ÖƵĻáÔ±×¢²á¡¢µÇ¼¶¼Ðèºó¶Ë³ÌÐòµÄÔËÐС£ºÜ¶àÍøÕ¾ËùÓõÄCGI³ÌÐòÖ÷ÒªÓÃPerl¡¢ASP¡¢Java¡¢PHP±àд£¬¶øÎÒÃÇÏÖÔÚËùÒªÓõľÍÊÇPHP¡£ËüÊÇÍêÈ«Ãâ·ÑµÄ£¬Õâ¾ÍÒª¸ÐлÄÇЩĬĬÎÞÎŵıà³ÌÈËÔ±ÁË¡£PHPµÄ½á¹¹ÀàËÆÓÚ£ÃÓïÑÔ£¬Õâ¿ÉÊÇÓ¦Ö¤ÁË£ÃÓïÑÔÀïÌáµÄ“Ò»´¦Ñ§Ï°£¬µ½´¦±à³Ì”¡£ÏàÐÅѧ¹ý£ÃÓïÑÔµÄÈ˿ɺÜÈÝÒ×ÉÏÊÖPHPµÄ¡£»¹ÊÇÏȽéÉÜһЩPHPÓï·¨°É¡£±¾ÎÄÊʺϳõѧÕßѧϰ¡£
¡¡¡¡PHPÓë£ÃÓïÑÔÒ²ÓÐһЩ²î±ð£¬»òÕß˵ÔÚijÖ̶ֳÈÉÏ¿ÉÄܱȣÃÓïÑÔ¸üΪÁé»î¡£ÔÚ£ÃÓïÑÔÖУ¬±äÁ¿ÒªÏȶ¨Ò壬²ÅÄÜʹÓ᣶øPHPÖбäÁ¿Ôò²»ÐèÊÂÏȶ¨Ò壬ֱ½ÓʹÓü´¿É¡£¶ÔÓÚ±äÁ¿µÄÀàÐÍ£¬ÔÚ¸³ÖµÊ±×Ô¶¯Éú³É¡£PHP±äÁ¿µÄÀàÐÍ·ÖΪ£ºÕûÊý(int)¡¢Ë«¾«¶ÈÐÍ(double)¡¢×Ö·û´®(string)¡¢Êý×é(array)¡¢¶ÔÏó(object)¡£
     ÕûÊý´óС³¬³öÆ䷶Χºó£¬×Ô¶¯×ª»¯ÎªË«¾«¶ÈÐÍ£¬ÆäÖµ·¶Î§ÈçÏÂ±í£º
ÉùÃ÷ÀàÐÍ
³¤¶È(λ)
³¤¶È(×Ö½Ú)
ÖµµÄ·¶Î§
int
32
4
-2147483647¡«2147483647
double
32
4
1.7E-308¡«1.7E+308
×Ö·û´®£¬Í¨³£ÓÃ""(Ë«ÒýºÅ)±íʾ¡£Ò²¿ÉÓÃ''(µ¥ÒýºÅ)±íʾ£¬ÈçÏ£º
$a="abc";
$b="abc$ ......

ÔÚFedora 12Öа²×°Apache2+PHP5+MySQL£¨LAMP£©

1.
Ç°ÑÔ
ÎÒʹÓõÄÖ÷»úÃûΪserver1.example.com
£¬ip
µØÖ·ÊÇ192.168.0.100
¡£ÕâЩÉèÖÿÉÄÜÓëÄãÏëÒªµÄÓÐËù²»Í¬£¬ËùÒÔÄã±ØÐëÔÚÊʵ±µÄµØ·½ÐÞ¸Äһϡ£
2
°²×°MySQL5
ÓÃÏÂÁÐÃüÁî°²×°MySQL
£º
yum install mysql mysql-server
È»ºóÎÒÃÇΪMySQL
´´½¨ÏµÍ³Æô¶¯Á´½Ó£¨ÕâÑùµÄ»°£¬MySQL
¾Í»áËæ×ÅϵͳÆô¶¯¶øÆô¶¯£©£¬²¢Æô¶¯MySQL
·þÎñÆ÷£º
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
ÔËÐÐ
mysqladmin -u root password yourrootsqlpassword
mysqladmin -h server1.example.com -u root password yourrootsqlpassword
À´Îªroot
Óû§ÉèÖÃÒ»¸öÃÜÂ루·ñÔòÈκÎÈ˶¼¿ÉÒÔ·ÃÎÊÄãµÄMySQL
Êý¾Ý¿â£¡£©
3
°²×°Apache2
Fedora
ĬÈÏÓÐApache2
Õâ¸ö°ü£¬ÎÒÃÇ¿ÉÒÔÓÃÏÂÁÐÃüÁî°²×°Ëü£º
yum install httpd
ÏÖÔÚÅäÖÃÏÂϵͳʹµÃApache
Äܹ»Ëæ×ÅϵͳÆô¶¯¶øÆô¶¯…
chkconfig --levels 235 httpd on
...
Æô¶¯Apache:
/etc/init.d/httpd start
ÏÖÔÚ´ò¿ªä¯ÀÀÆ÷£¬·ÃÎÊhttp://192.168.0.100
£¬Äã¾ÍÓ¦¸ÃÄÜ¿´µ½Apache2
µÄÔ¤ÁôÒ³ÁË£º
ÔÚFedora
ÖÐApache
µÄĬÈÏÎĵµÂ·¾¶ÔÚ/var/www/html
£¬ÅäÖÃÎļþÊÇ/etc/httpd/conf/httpd.conf
¡£ÆäÓàµÄÅäÖÃÎļþ´æ´¢Ô ......

ÔÚFedora 12Öа²×°Apache2+PHP5+MySQL£¨LAMP£©

1.
Ç°ÑÔ
ÎÒʹÓõÄÖ÷»úÃûΪserver1.example.com
£¬ip
µØÖ·ÊÇ192.168.0.100
¡£ÕâЩÉèÖÿÉÄÜÓëÄãÏëÒªµÄÓÐËù²»Í¬£¬ËùÒÔÄã±ØÐëÔÚÊʵ±µÄµØ·½ÐÞ¸Äһϡ£
2
°²×°MySQL5
ÓÃÏÂÁÐÃüÁî°²×°MySQL
£º
yum install mysql mysql-server
È»ºóÎÒÃÇΪMySQL
´´½¨ÏµÍ³Æô¶¯Á´½Ó£¨ÕâÑùµÄ»°£¬MySQL
¾Í»áËæ×ÅϵͳÆô¶¯¶øÆô¶¯£©£¬²¢Æô¶¯MySQL
·þÎñÆ÷£º
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
ÔËÐÐ
mysqladmin -u root password yourrootsqlpassword
mysqladmin -h server1.example.com -u root password yourrootsqlpassword
À´Îªroot
Óû§ÉèÖÃÒ»¸öÃÜÂ루·ñÔòÈκÎÈ˶¼¿ÉÒÔ·ÃÎÊÄãµÄMySQL
Êý¾Ý¿â£¡£©
3
°²×°Apache2
Fedora
ĬÈÏÓÐApache2
Õâ¸ö°ü£¬ÎÒÃÇ¿ÉÒÔÓÃÏÂÁÐÃüÁî°²×°Ëü£º
yum install httpd
ÏÖÔÚÅäÖÃÏÂϵͳʹµÃApache
Äܹ»Ëæ×ÅϵͳÆô¶¯¶øÆô¶¯…
chkconfig --levels 235 httpd on
...
Æô¶¯Apache:
/etc/init.d/httpd start
ÏÖÔÚ´ò¿ªä¯ÀÀÆ÷£¬·ÃÎÊhttp://192.168.0.100
£¬Äã¾ÍÓ¦¸ÃÄÜ¿´µ½Apache2
µÄÔ¤ÁôÒ³ÁË£º
ÔÚFedora
ÖÐApache
µÄĬÈÏÎĵµÂ·¾¶ÔÚ/var/www/html
£¬ÅäÖÃÎļþÊÇ/etc/httpd/conf/httpd.conf
¡£ÆäÓàµÄÅäÖÃÎļþ´æ´¢Ô ......

PHP »ñȡʱ¼ä²»×¼È· ²î8Сʱ µÄ ½â¾ö·½·¨

ÓÃPHP±à³Ì£¬Ê¹Óûñȡʱ¼äµÄ´úÂ룬µ«ÊÇ»ñÈ¡µ½µÄʱ¼ä×ÜÊDZȵ±Ç°Ê±¼äÔç8¸öСʱ£¬°Ù˼²»µÃÆä½â£¬ÔÚÍøÉÏËÑË÷ÁËÏ£¬ÖÕÓÚÕÒµ½Á˽â¾ö°ì·¨£¬Ô­À´ÊÇʱÇøÉèÖÃÎÊÌâ¡£ ½â¾ö°ì·¨Ò»£º ÔÚphp.iniÀïÉèÖà date.timezone = ʱÇø ½â¾ö°ì·¨¶þ£º ²»ÓÃÐÞ¸Äphp.inÎļþ£¬Ö±½ÓÔÚ»ñȡʱ¼äµÄ´úÂëÇ°Ãæ¼ÓÉÏ£º date_default_timezone_set('ʱÇø'); ±ÈÈç date_default_timezone_set('Asia/Shanghai'); $time = date('Y-m-d H:i:s'); ¿ÉÒÔ»ñÈ¡µ½GMT+8ʱÇøµÄʱ¼ä ½¨ÒéµÄʱÇø£º Asia/Shanghai £¨ÉϺ£ËùÊôµÄʱÇø£© Etc/GMT+8 £¨±ê×¼GMT+8ʱÇø£© PRC £¨ÖлªÈËÃñ¹²ºÍ¹ú£© ²Î¿¼ Php¹Ù·½ËùÖ§³ÖʱÇøÁбí ......

PHP³£ÓÃÕýÔò±í´ïʽ

    Æ¥ÅäÖÐÎÄ×Ö·ûµÄÕýÔò±í´ïʽ
£º [\u4e00-\u9fa5]
    Æ¥ÅäË«×Ö½Ú×Ö·û(°üÀ¨ºº×ÖÔÚÄÚ)
£º ["\x00-\xff]
    Ó¦Ó㺼ÆËã×Ö·û´®µÄ³¤¶È
£¨Ò»¸öË«×Ö½Ú×Ö·û³¤¶È¼Æ2£¬ASCII×Ö·û¼Æ1£©
    String.prototype.len=function(){return
this.replace(["\x00-\xff]/g,"aa").length;}
    Æ¥Åä¿ÕÐеÄÕýÔò±í´ïʽ
£º [\s| ]*\r
    Æ¥ÅäHTML±ê¼ÇµÄÕýÔò±í´ïʽ£º /<(.*)>.*<\/>|<(.*) \/>/
    Æ¥ÅäÊ×β¿Õ¸ñµÄÕýÔò±í´ïʽ
£º ("\s*)|(\s*$)
    Ó¦ÓãºjavascriptÖÐûÓÐÏñvbscriptÄÇÑùµÄtrimº¯Êý£¬ÎÒÃǾͿÉÒÔÀûÓÃÕâ¸ö±í´ïʽÀ´ÊµÏÖ£¬ÈçÏ£º
    String.prototype.trim = function() {
    return this.replace(/("\s*)|(\s*$)/g, "");
    }
    ÀûÓÃÕýÔò±í´ïʽ·Ö½âºÍת»»IPµØÖ·
£º
    ÏÂÃæÊÇÀûÓÃÕýÔò±í´ïʽƥÅäIPµØÖ·£¬²¢½«IP ......

php Á¬½ÓaccessµÄ´úÂë

<?php
$connstr="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("data.mdb");
$connid=odbc_connect($connstr,"","",SQL_CUR_USE_ODBC);
$issuetime=date("Y-m-d H:i:s");
$sql="insert into test values("","",...)";
$result=odbc_exec($connid,$sql);
if($result) echo "successful";
else echo "failed";
?>
[/php]
accessÊý¾Ý¿âÃûΪdata.mdb,ÀïÃæÓÐÒ»¸öÊý¾Ý±ítest,´úÂëÔËÐгɹ¦£¬Ï£Íû¶ÔҪʹÓÃPHP+Access×öphp³ÌÐòµÄÈËÓÐËù°ïÖú ......

php Á¬½ÓaccessµÄ´úÂë

<?php
$connstr="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("data.mdb");
$connid=odbc_connect($connstr,"","",SQL_CUR_USE_ODBC);
$issuetime=date("Y-m-d H:i:s");
$sql="insert into test values("","",...)";
$result=odbc_exec($connid,$sql);
if($result) echo "successful";
else echo "failed";
?>
[/php]
accessÊý¾Ý¿âÃûΪdata.mdb,ÀïÃæÓÐÒ»¸öÊý¾Ý±ítest,´úÂëÔËÐгɹ¦£¬Ï£Íû¶ÔҪʹÓÃPHP+Access×öphp³ÌÐòµÄÈËÓÐËù°ïÖú ......

PHPͨ¹ýsession id ʵÏÖsession¹²ÏíºÍµÇ¼ÑéÖ¤[ת]

http://edu.codepub.com/2010/0131/20248.php
ÆäʵÕâ¸öÓ¦¸Ã²»ËãÊÇÒÉÄÑÎÊÌ⣬¾ÍÊÇphpÖÐÓàsessionidµÃµ½sessionµÄÖµ£¬ÒòΪµÄÈ·ºÜ¼òµ¥£¬Ö»ÊÇ¿ÉÄÜ´ó¼ÒƽʱÓò»µ½ËùÒÔûÓÐ×¢Òâµ½°ÕÁË¡£
 
ÏÈ˵˵£¬Õâ¸ö»úÖƵÄÓÃ;°É£¬µ½ÏÖÔÚΪֹսµØÖªµÀÕâ¸ö»úÖÆÓÐÁ½¸ö·½ÃæµÄÓÃ;£º
ÆäʵÕâ¸öÓ¦¸Ã²»ËãÊÇÒÉÄÑÎÊÌ⣬¾ÍÊÇphpÖÐÓà sessionidµÃµ½sessionµÄÖµ£¬ÒòΪµÄÈ·ºÜ¼òµ¥£¬Ö»ÊÇ¿ÉÄÜ´ó¼ÒƽʱÓò»µ½ËùÒÔûÓÐ×¢Òâµ½°ÕÁË¡£
 
ÏÈ˵˵£¬Õâ¸ö»úÖƵÄÓÃ;°É£¬µ½ÏÖÔÚΪֹսµØÖªµÀÕâ¸ö»úÖÆÓÐÁ½¸ö·½ÃæµÄÓÃ;£º
Ê×ÏÈ£¬¶à·þÎñÆ÷¹²ÏísessionÎÊÌ⣬Õâ¸ö´ó¼ÒÓ¦¸Ã¶¼Äܹ»Àí½âµÄ£¬µ±Ò»¸öÍøÕ¾µÄÓû§Á¿¹ý´ó£¬¾Í»áʹÓ÷þÎñÆ÷¼¯Èº£¬ÀýÈçרÃÅÓÐÒ»¸öµÇ¼ÓõķþÎñÆ÷¡£ Óû§Í¨¹ýµÇ¼·þÎñÆ÷µÇ¼֮ºó£¬µÇ¼·þÎñÆ÷±£´æÁËÓû§µÄµÇ¼ÐÅÏ¢session£¬¶øÆäËûÊÜ·ÃÎʵķþÎñÆ÷£¬ÀýÈçµçÓ°·þÎñÆ÷ûÓÐÕâ¸ösession£¬ÄÇôÎÒÃÇ¾Í ÒªÍ¨¹ýÒ»¸ösessionµÄΨһ±êʶÀ´¹²ÏíÕâ¸ösessionÁË——¾ßÌåsessionµÄ¹²Ïí³¬³öÁ˱¾Îĵķ¶Î§£¬Çë×ÔÐвéÔÄ×ÊÁÏ¡£
µÚ¶þ¸öÓÃ;¾ÍÊÇ£¬Ñé֤ͬһÓû§µÄ²»Í¬»á»°£¬Õâ¸ö±È½ÏÄÑÀí½â¡£ÕâÑù˵°É£¬Ò»¸öÓû§²¢·Çͨ¹ýä¯ÀÀÆ÷À´ÇëÇóÁ¬½Ó£¬¶øÊÇͨ¹ýsocket»òÕßÆäËü·½Ê½À´ÇëÇó Êý¾ÝµÄʱºò£¬ÎÒÃÇÊ×ÏÈÒª¶ÔËû½øÐÐ ......
×ܼǼÊý:2174; ×ÜÒ³Êý:363; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [8] [9] [10] [11] 12 [13] [14] [15] [16] [17]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ