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.
Èç¹û¸Ã³
Ïà¹ØÎĵµ£º
ÕûÀíһƪ±È½ÏÏêϸµÄwindowsÏÂphpÔËÐл·¾³µÄÅäÖõÄ×ÊÁÏ£¬°üÀ¨apacheµÄ°²×°¡¢mysqlµÄ°²×°¡¢phpµÄ°²×°¡¢ ZendOptimizer µÄ°²×°¡¢phpMyAdminµÄ°²×°£¬°üÀ¨°²×°¹ý³Ì»á³öÏÖµÄÎÊÌâµÄ½â¾ö£¬±ÈÈ磺phpMyAdminÊý¾Ý¿âÖÐÎÄÂÒÂëµÄ½â¾öµÈ¡£
//****************
1¡¢Èí¼þ
(1)apache_2.2.4-win32-x86-no_ssl.zip
(2)mysql-5.0.27-win32.zi ......
ÍƼöСÇÉµÄ PHP ¿ò¼Ü
CodeIgniter ÊÇÒ»¸öСÇɵ«¹¦ÄÜÇ¿´óµÄ PHP ¿ò¼Ü£¬×÷Ϊһ¸ö¼òµ¥¶ø“ÓÅÑÅ”µÄ¹¤¾ß°ü£¬Ëü¿ÉÒÔΪ PHP ³ÌÐòÔ±½¨Á¢¹¦ÄÜÍêÉÆµÄ Web Ó¦ÓóÌÐò¡£Èç¹ûÄãÊÇÒ»¸öʹÓù²ÏíÖ÷»ú£¬²¢ÇÒΪ¿Í»§ËùÒªÇóµÄÆÚÏÞ¶ø·³ÄյĿª·¢ÈËÔ±£¬Èç¹ûÄãÒѾÑá¾ëÁËÄÇЩɵ´ó±¿´ÖµÄ¿ò¼Ü.
ÀïÃæ°üº¬ÁËÈÕ³£ËùÐèÒªµÄÀà¿â£¬´úÂ뾫¼ò¡£ºÜÊ ......
VC9,VC6,Thread Safe,Non Thread SafeµÄÒâ˼?
ʱ¼ä:2009-10-07 10:55À´Ô´:ÍøÂç ×÷Õß:CNITonline.comÕûÀí ÎÒҪͶ¸å ×¢²áIT¼ÒÔ°
×î½üÔÚPHP¹ÙÍøÉÏ¿´µ½ÓÖÓÐаæµÄPHPÏÂÔØÁË£¬ÓÚÊÇÉÏÈ¥ÕÒÕÒFor WindowsµÄ°æ±¾£¬¿ÉÊÇÒ»¿´È·ÉµÑÛÁË£¬Ò»¹²¸øÁËËĸö°æ±¾£¬VC9 x86 Non Thread Safe¡¢VC9 x86 Thread Safe¡¢VC6 x86 Non Thread Safe¡¢VC ......
PHP
´¦Àí¶ÔÏ󲿷ֵÄÄÚºËÍêÈ«ÖØпª
·¢¹ý£¬Ìṩ¸ü¶à¹¦ÄܵÄͬʱҲÌá¸ßÁËÐÔÄÜ¡£ÔÚÒÔÇ°°æ±¾µÄ
php
ÖУ¬´¦Àí¶ÔÏóºÍ´¦Àí»ù±¾ÀàÐÍ
£¨Êý×Ö£¬×Ö·û´®£©µÄ·½Ê½ÊÇÒ»ÑùµÄ¡£ÕâÖÖ·½Ê½µÄȱÏÝÊÇ£ºµ±½«¶ÔÏó¸³Öµ¸øÒ»¸ö±äÁ¿Ê±£¬»òÕßͨ¹ý²ÎÊý´«µÝ¶ÔÏóʱ£¬¶ÔÏ󽫱»ÍêÈ«¿½±´Ò»·Ý¡£ÔÚеİ汾ÀÉÏÊö²Ù×÷
½«´«µÝÒýÓ㨿ÉÒÔ°ÑÒýÓÃÀí½â³É¶ÔÏóµÄ ......