10ÌõPHP±à³ÌÏ°¹ßÖúÄãÕÒ¹¤×÷
1¡¢Ê¹Óõ¥ÒýºÅÀ¨ÆðÀ´µÄ×Ö·û´®
µ±Ê¹ÓÃË«ÒýºÅÀ´À¨×Ö·û´®Ê±£¬PHP½âÊÍÆ÷»á¶ÔÆä½øÐбäÁ¿Ìæ»»¡¢×ªÒåµÈ²Ù×÷£¬Èç
“\n”¡£Èç¹ûÖ»ÏëÊä³öÒ»¸ö»ù±¾µÄ×Ö·û´®£¬Óõ¥ÒýºÅ»á½ÚʡһЩ×ÊÔ´¡£µ±È»£¬Èç¹ûÐèÒª½øÐбäÁ¿Ìæ»»µÄ£¬ÄǾͱØÐëÓÃË«ÒýºÅÁË¡£
2¡¢×Ö·û´®µÄÊä³ö
ÒÔÏÂÄÄÒ»ÌõÓï¾äµÄÔËÐÐËÙ¶È×î¿ì£¿
print “Hi my name is $a. I am $b”$$
echo “Hi my name is $a. I am $b”$$
echo “Hi my name is “.$a.”. I am “.$b;
echo “Hi my name is “,$a,”. I am “,$b;
echo ‘Hi my name is ‘,$a,’. I am ‘,$b;
×îºóÒ»ÌõµÄÔËÐÐËÙ¶ÈÊÇ×î¿ìµÄ¡£
print±ÈechoÒªÂý£¬ÔÚ×Ö·û´®ÖнøÐбäÁ¿Ì滻ʱ»áÂý£¬¶øÁ¬½Ó×Ö·û´®Òª±ÈÓöººÅÁ¬½ÓÀ´µÃÂý£¬×îºóÒ»¾äÔòÊǵÚÒ»¸öÏ°¹ßµÄÌåÏÖ¡£ËùÒÔ£¬²»ÔÚ×Ö·û´®ÖнøÐбä
Á¿Ìæ»»²»½ö»á¼Ó¿ì³ÌÐòÔËÐÐËٶȣ¬Ò²»áÈÃÄãµÄ´úÂëÔÚÈκÎÓï·¨¸ßÁÁÏÔʾµÄ±à¼Æ÷ÖÐÏԵøüΪÒ׶®£¨±äÁ¿»á±»¸ßÁÁÏÔʾ³öÀ´£©¡£ºÜÉÙÈËÖªµÀechoµÄ²ÎÊý¿ÉÒÔÓöººÅ
Á¬½Ó£¬ÇÒËٶȻá±È×Ö·û´®Á¬½ÓÒªÀ´µÃ¿ì¡£×îºóÔÙÓÃÉϵÚÒ»¸öÏ°¹ß£¬ÄÇÕâÌõÓï¾ä¾Í·Ç³£ºÃÁË¡£
3¡¢ÔÚÊý×éË÷ÒýÖÐʹÓõ¥ÒýºÅ
Õý
ÈçÄãÔÚÉÏÃæµÄ²âÊÔÌâÖÐËù¿´µ½µÄ£¬$x[sales]´ÓÑϸñÒâÒåÉÏÀ´ËµÊÇ´íÎóµÄ£¬Ë÷ÒýÓ¦¸Ã±»À¨ÆðÀ´£¬¼´$x['sales']¡£ÕâÊÇÒòΪPHP»á½«
ûÓÐÀ¨ÆðÀ´µÄË÷Òý±æÈÏΪ“Âã”×Ö·û´®£¬²¢°ÑËü½âÊÍΪһ¸ö³£Á¿¡£µ±ÕÒ²»µ½¸Ã³£Á¿µÄ¶¨Òåʱ£¬²Å½«Æä½âÊÍΪһ¸ö×Ö·û´®£¬ËùÒÔÕâÌõÓï¾ä²ÅÊÇ¿ÉÔËÐеġ£°ÑË÷ÒýÀ¨ÆðÀ´
¿ÉÒÔÊ¡È¥Õⲿ·Ö¹¤×÷£¬Èç¹û½«À´ÕýºÃÒªÓÃÕâÒ»×Ö·û´®¶¨Òå³£Á¿Ê±Ò²¾Í²»»áÓдíÎóÁË¡£
4¡¢²»Ê¹ÓÿªÊ¼±êÖ¾µÄËõдÐÎʽ
ÄãÕýÔÚʹÓÃ
ÕâÑùµÄ·ûºÅÂ𣿓<?”ÊǷdz£Ôã¸âµÄ·ûºÅ£¬Ëü»áÒýÆðÓëXML½âÊÍÆ÷µÄ³åÍ»¡£¶øÇÒÒ»µ©Äã·¢²¼ÁËÕâЩ´úÂ룬ÄÇôʹÓÃÕ߾ͱØÐëÐÞ¸Äphp.iniÎļþÀ´´ò
¿ª¶Ô´Ë·ûºÅµÄÖ§³Ö¡£ËùÒÔʵÔÚûÓÐÀíÓÉȥʹÓÃÕâÖÖÐÎʽ¡£ÓÓ<?php“°É¡£
5¡¢¾¡Á¿²»ÒªÊ¹ÓÃÕýÔò±í´ïʽ
ÔÚ½øÐÐ
³£¹æµÄ×Ö·û´®²Ù×÷ʱ£¬¾¡¿ÉÄܲ»ÒªÈ¥Ê¹ÓÃÕýÔò±í´ïʽ£¨pregºÍeregϵÁк¯Êý£©¡£str_replaceº¯ÊýÒª±Èpreg_replace¿ìµÃ¶à£¬ÉõÖÁ
strtrº¯ÊýÒ²Òª±Èstr_replaceÀ´µÃ¿ì¡£Ê¡È¥ÕâЩ²»±ØÒªµÄÂé·³°É£¬ÄãµÄÀÏ°å»á¸ÐлÄãµÄ¡£
6¡¢²»ÒªÔÚÑ»·ÉùÃ÷ÖÐʹÓú¯Êý
Õâ¸öÎÊÌâ²»µ¥µ¥³öÏÖÔÚPHPÖУ¬Äã¿ÉÒÔÔÚÆäËûÓïÑԵĴúÂëÖо³£¿´µ½£º
²î£ºfor($i=0;$i< count($array);$i++){…}
ºÃ£º$count=count($arr
Ïà¹ØÎĵµ£º
copy F:\php\php5ts.dll F:\Apache2.2\bin\
copy F:\php\libmysql.dll F:\Apache2.2\bin\
copy F:\php\php.ini-recommended F:\php\php.ini
httpd:
LoadModule php5_module "F:\php\php5apache2_2.dll"
PHPIniDir "F:\php\php.ini"
AddType application/x-httpd-php .php
php.ini:
short_open_tag = Off ¸Ä³É sho ......
Linux + Apache2.0 + Mysql + PHP + phpBB3.0
1.°²°ü£º
Apache2.0
#tar -zxf httpd-***.tar.gz -C /usr/local/src/
#cd /usr/local/src/httpd-***
  ......
ÏÖÔÚ°ÑÔÚIISÏ°²×°PHPµÄ¹ý³ÌÏêϸ¼Ç¼ÏÂÀ´±ãÓÚÈÕºóµÄѧϰ£»
ΪÁË·½±ã¸÷λ¶ÁÕßʹÓÃPHP£¬±ÊÕßÑ¡ÔñÁËPHP5.2°æ±¾£¬¶øIISÔòÊÇXPϵͳ×Ô´øµÄIIS 5¡£Ê×ÏÈÎÒÃÇÒª°²×°IIS×é¼þ£¬Ä¬ÈÏÇé¿öÏÂÔÚXPϵͳÊÇûÓа²×°µÄ¡£
¡¡µÚÒ»²½£ºÍ¨¹ý¿ØÖÆÃæ°åµÄÌí¼Ó/ɾ³ýWindows×é¼þÍê³ÉIIS×é¼þµÄ°²×°¹¤×÷¡£
¡¡µÚ¶ ......
ʹÓÃpopen½áºÏSHELLÃüÁîÒ²¿ÉÒÔʵÏÖ¶à½ø³Ì²¢·¢±à³Ì¡£
ʵÀýÈçÏ£º
<?php
//b.phpÎļþ
$file = 'testdir/file.txt';
for ($i=0;$i<10;$i++){
$fp = fopen($file,'a+');
fputs($fp, $i.'\r\n');
fclose($fp);
sleep(1);
}
?> ......
1. ÈçºÎÓÃphpµÄ»·¾³±äÁ¿µÃµ½Ò»¸öÍøÒ³µØÖ·µÄÄÚÈÝ£¿ipµØÖ·ÓÖÒªÔõÑùµÃµ½£¿
[php]
echo $_SERVER ['PHP_SELF'];
echo $_SERVER ['SERVER_ADDR'];
[/php]
2. ÇóÁ½¸öÈÕÆڵIJîÊý£¬ÀýÈç2007-2-5 ~ 2007-3-6 µÄÈÕÆÚ²îÊý
[php]
$begin=strtotime('2007-2-5');
$end=strtotime('2007-3-6');
echo ($end-$begin)/(24*3600);
[ ......