phpѧϰ±Ê¼Ç
µÚÒ»Õ PHP¸ÅÊö
1¡¢ »ù±¾Óï·¨
a) Òª°ÑphpǶÈëÒ³Ã棬¿ÉÒÔ°ÑËü·ÅÔÚPHP±êÇ©ÄÚ
<?php ?>
b) ÔÚbody±êÇ©½áÊø֮ǰ£¬²åÈëphp´úÂë
c) Ï£ÍûÕýÈ·ÔËÐÐphp£¬±ØÐë±£Ö¤ÕýÔÚͨ¹ýURLÔËÐнű¾£¬webä¯ÀÀÆ÷ÖеØÖ·±ØÐëÒÔhttp:¿ªÍ·¡£ÒÔfile:¿ªÍ·Ôò¿Ï¶¨³öÎÊÌâ¡£
d) Èç¹ûµÃµ½ÎÊÕÒµ½Îļþ´íÎó£¨Â·¾¶´í 404£©£¬Ôò¼ì²éÎļþĿ¼ÊÇ·ñ·Å´í
×¢Ò⣺php²»·Ö´óСд Echo ºÍeCHo ºÍechoµÈ¼Û
ÔÚ´òÓ¡Ë«ÒýºÅºÍµ¥ÒýºÅ×÷ΪÏûÏ¢µÄÒ»²¿·ÖµÄʱºò£¬ÒªÐ¡ÐÄ£¨ÐèҪתÒ壩
´òÓ¡ÌØÊâ×Ö·û
1¡¢ ²ð·Ö
2¡¢ תÒå
echo “she said , \”how are you !\””; // ºìɫΪתÒ岿·Ö
²âÊÔʱ Èç¹û¿´µ½ÍêÈ«¿Õ°×Ò³Ã棬¿ÉÄÜÊÇ html´úÂëÎÊÌâ
echo ºÍprintÒ²³£ÓÃÓÚ·¢ËÍ html´úÂ룬 È磺
echo ‘<p>Hello <strong>World!</strong>’</p>;
¿Õ°×£º phpÒ»°ã»áºöÂÔ¿Õ°×£¬ echoÖеĻ»ÐÐÖ»ÄÜÔì³ÉhtmlÔ´Âë»»ÐУ¬²»»áÔÚä¯ÀÀÆ÷ÖÐÏÔʾ
×¢ÊÍ
HtmlÖеÄ×¢ÊÍÔÚÔ´ÎļþÖпÉÒÔ¿´µ½
PhpÖеÄ×¢Ê͸ù±¾²»»á·¢Ë͵½webä¯ÀÀÆ÷£¬×îÖÕÓû§²»»á¿´µ½ËüÃÇ
PHPµÄÈýÖÖ×¢ÊÍ
1¡¢ ÓñàºÅ·ûºÅ×¢ÊÍ
# µÚÒ»ÖÖ×¢ÊÍ
2¡¢ ÓÃÁ½¸öб¸Ü×¢ÊÍ
// µÚ¶þÖÖ×¢ÊÍ
3¡¢ ¶àÐÐ×¢ÊÍ
/* ÕâһƬ¶¼ÊÇ×¢ÊÍ
µÚ¶þÅÅ»¹ÊÇ
*/
±à³ÌÏ°¹ß£º ÿ¸ö½Å±¾¶¼Ó¦¸Ã°üº¬¼¸Ìõ½âÊÍÐÔµÄ×¢ÊÍ£¬Áгö´´½¨ÈÕÆÚ¡¢ÐÞ¸ÄÈÕÆÚ¡¢´´½¨Õß¼°ÆäÁªÏµÐÅÏ¢
Óï·¨
±äÁ¿
1¡¢ ±äÁ¿Ãû±ØÐëÒÔÃÀÔª·ûºÅ£¨$£©¿ªÍ·
2¡¢ ÃÀÔª·ûºÅºóÃæµÚÒ»¸ö×Ö·û²»ÄÜÊäÊý×Ö
3¡¢ ¿ÉÒÔʹÓÃ=¸ø±äÁ¿¸³Öµ
4¡¢ ÎÞÐèÒýºÅ¼´¿É´òÓ¡±äÁ¿
5¡¢ ¿ÉÒÔÔÚË«ÒýºÅÄÚ´òÓ¡±äÁ¿
print “hello $name”;
6¡¢ ²»ÄÜÔÙµ¥ÒýºÅÄÚ´òÓ¡±äÁ¿
×¢Ò⣺PHP´¦Àí±äÁ¿µÄ·½Ê½·Ç³£Áé»î£¬²»±Ø³õʼ»¯»òÉùÃ÷£
Ïà¹ØÎĵµ£º
<?php
function make_rand($length="32"){//ÑéÖ¤ÂëÎÄ×ÖÉú³Éº¯Êý
$str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
$result="";
for($i=0;$i<$length;$i++){
$num[$i]=rand(0,61);
$result.=$str[$num[$i]];
}
return $result;
} ......
×°ÁËPHP-5.3.0, Æô¶¯µÄʱºò×ÜÊÇ»áÓÐ
"[06-Aug-2009 13:27:31] PHP Warning: PHP Startup: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are stil ......
×÷ÕߣºMartin Streicher, Èí¼þ¿ª·¢ÈËÔ±, Pixel, Byte, and Comma
¾¡¹Ü±àдһ¸ö PHP À©Õ¹²¢²»ÊǺÜÀ§ÄÑ£¬¶ø SWIG µÄÈ·½øÒ»²½¼ò»¯ÁËÕâÏîÈÎÎñ£¬ÕâÖ÷ÒªÊÇÒòΪËü×Ô¶¯»¯Á˽áºÏ PHP Óë C »ò C++ ËùÐèµÄ¹¤×÷¡£Èô¸ø¶¨¶ÔÒ»¸öº¯ÊýµÄÃè»æ — º¯ÊýµÄÃû³Æ¼°ÆäÐβΠ— SWIG ¾Í»áÉú³ÉÒ»¸ö°ü×°³ÌÐòÀ´½« PHP ÓëµÍ²ã´úÂëÁ¬½ÓÆðÀ´¡£
......
°²×°Íêphp ºÍ apacheºó£¬Èç¹ûapache ²»Ö§³Ö php
1.apacheÖÐûÓÐ php¼ÓÔØÄ£¿é¡£
ÔÚhttpd.confÖмÓÈë¡£
LoadModule php5_module "c:/php5/php5apache2_2.dll"
AddType application/x-httpd-php .php
Èç¹û ²»ÄÜÕý³£Æô¶¯apache ¿ÉÄÜÊÇapache°æ ±¾µÄÊ¡£¿ÉÒÔÐÞ¸Ä LoadModule php5_module "c:/php5/php5apache2_2.dll"
&n ......
<?php
function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
//Àý×Ó
//¿ªÊ¼
$time_start = getmicrotime();
//ÕâÀï·ÅÄãµÄ´úÂë
......