Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

php define() º¯Êý¼°defined£¨£©º¯ÊýµÄÓ÷¨


The define() function defines a constant.
define()º¯ÊýµÄ×÷ÓÃÊÇ£º¶¨ÒåÒ»¸ö³£Á¿¡£
Constants are much like variables, except for the following differences:
³£Á¿[constant]Óë±äÁ¿[variable]ÓкܶàÏàËƵĵط½£¬Òò´Ë£¬ºÜÈÝÒ×»ìÏý£»ÏÂÃ棬ÎÒÃÇÁоÙһϳ£Á¿[constant]Óë±äÁ¿[variable]Ö®¼äµÄ²»Í¬µã£º
A constant's value cannot be changed after it is set
Ò»¸ö³£Á¿ÖµÔÚÖ¸¶¨Ö®ºó¾Í²»¿ÉÒÔ¸ü¸Ä£»
Constant names do not need a leading dollar sign ($)
ÉèÖó£Á¿Ê±£¬²»ÐèÒªÔÚÇ°Ãæ¼ÓÉÏ“$”·ûºÅ£»
Constants can be accessed regardless of scope
³£Á¿¿ÉÒÔ±»ËùÓз¶Î§µÄÓò·ÃÎÊ£»
Constant values can only be strings and numbers
³£Á¿µÄÖµÖ»ÄÜÊÇ“×Ö·û´®[string]”ºÍ“Êý×Ö[number]”£»
Syntax
Óï·¨
define(name,value,case_insensitive)
 
Parameter
²ÎÊýDescription
ÃèÊö
name
Required. Specifies the name of the constant
±ØÒª²ÎÊý¡£Ö¸¶¨³£Á¿µÄÃû³Æ
value
Required. Specifies the value of the constant
±ØÒª²ÎÊý¡£Ö¸¶¨³£Á¿µÄÖµ
case_insensitive
Optional. Specifies whether the constant name should be case-insensitive. If set to TRUE, the constant will be case-insensitive. Default is FALSE (case-sensitive)
¿ÉÑ¡²ÎÊý¡£Ö¸¶¨³£Á¿µÄÃû³ÆÊÇ·ñÊDz»Çø·Ö´óСдµÄ[case-insensitive]¡£Èç¹ûÉèÖÃΪTrue£¬Ôò²»Çø·Ö×Öĸ´óСд£»Èç¹ûÉèÖÃΪFalse£¬ÔòÇø·Ö×Öĸ´óСд¡£Ä¬ÈÏÖµÊÇ£ºFalse
Example 1
°¸Àý1
Define a case-sensitive constant:
Ö¸¶¨Ò»¸ö³£Á¿£¨Çø·Ö´óСд£©£º
<?phpdefine("GREETING","Hello you! How are you today?");echo constant("GREETING");?>
The output of the code above will be:
ÉÏÊö´úÂ뽫Êä³öÏÂÃæµÄ½á¹û£º
Hello you! How are you today?
Example 2
°¸Àý2
Define a case-insensitive constant:
Ö¸¶¨Ò»¸ö³£Á¿£¨²»Çø·Ö´óСд£©£º
<?phpdefine("GREETING","Hello you! How are you today?",TRUE);echo constant("greeting");?>
The output of the code above will be:
ÉÏÊö´úÂ뽫Êä³öÏÂÃæµÄ½á¹û£º
Hello you! How are you today?
The defined() function checks whether a constant exists.
defined()º¯ÊýµÄ×÷ÓÃÊÇ£º¼ì²éÒ»¸ö³£Á¿ÊÇ·ñ´æÔÚ¡£
Returns TRUE if the constant exists, or FALSE otherwise.
Èç¹û¸Ã³


Ïà¹ØÎĵµ£º

ÓÃPHPץȡÊý¾Ý

ÓÃPHPʵÏÖ¼òµ¥µÄÊý¾Ýץȡ
·½·¨Ò»£º
<?php
     $urlstr = file_get_contents("http://www.baidu.com");
     $urlstr = htmlspecialchars($urlstr);
     print_r($urlstr);
?>
·½·¨¶þ£º£¨ÐèÒª´ò¿ªcurlÀ©Õ¹£©
×¢Ò⣺´ò¿ªcurlÀ©Õ¹Ê±£¬Ò»¶¨Òª¿´¿ ......

PHPÊý×éµÄÈëÕ»Óë³öÕ»


ÔÚPHPÖУ¬Èëջͨ¹ýarray_pushº¯ÊýʵÏÖ£¬Óï·¨ÈçÏ£º
int array_push(array,var [,var …])
varΪҪѹÈëÊý×éµÄÔªËØ£¬arrayΪÊý×é¡£º¯Êý·µ»ØÊý×éеÄÔªËØ×ÜÊý¡£
ÀýÈ磺
<?php  
$php =  array("php","phpdo","phpѧϰ");  
print_r($php);  
array_push($php, ......

php smarty °²×° ¡¢ÅäÖá¢Ê¹Óà ¼°»º´æcacheµÄÅäÖÃʹÓÃ

cache ʹÓãº
    cacheÅäÖãº
    $smarty->cache_dir = "/caches/";  //»º´æĿ¼   
    $smarty->caching = true;  //¿ªÆô»º´æ,ΪflaseµÄʱºî»º´æÎÞЧ   
    $sma ......

php»·¾³´î½¨

phpÏÂÔØ£º
http://windows.php.net/download/
Ñ¡Ôñ
VC6 x86 Thread Safe (2010-Mar-04 20:11:08)
VC6 x86´ú±í Apache HTTP Server (httpd) 2.2.15 ºÍPHP½áºÏ
apacheÏÂÔØ£º
http://httpd.apache.org/download.cgi#apache22
Ñ¡Ôñ2.2.15
httpd-2.2.15-win32-x86-no_ssl.msi [PGP] [MD5] [SHA1]
apache services 2.2Ð ......

Mini2SAE »ùÓÚSAEÇáÁ¿¼¶PHP¿ª·¢¿ò¼Ü


Mini2SAE
£º
Mini
--ºËÐÄÎļþÖ»ÓÐ15K
£¬
2
--to£¬
SAE
--Sina App Engine(ÐÂÀËÓ¦ÓÃÒýÇæ)

»ùÓÚSAE¿ìËÙ¡¢¼òµ¥µÄ¡¢ÇáÁ¿¼¶PHP¿ª·¢¿ò¼Ü……
×ñÑ­BSD¿ªÔ´Ð­ÒéµÄÃâ·Ñ¿ªÔ´¿ò¼Ü……
Ϊ²ÉÓ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ