Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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


Ïà¹ØÎĵµ£º

CentOS apache+mysql+php°²×°

CENTOS 5µÄÐéÄâ»ú£¬Ôõô´ÓͼÐνçÃæÇл»µ½ÃüÁîÐнçÃæ
1.ÁÙʱÇл»£º
ctrl+alt+1 …… ctrl+alt+6Ò»¹²Áù¸ö¿ØÖÆ̨¡£
2.ÓÀ¾Ã¹Ø±ÕͼÐλ¯£º
ÔÚrootÏÂÊäÈë vi /etc/inittab ½«init:5ÐÞ¸ÄΪinit:3 
Mysql rpm°ü°²×°£¬²»ÄÜÖض¨Î»(relocatable)
rpm°ü°²×°Òì³££¬--prefix ²ÎÊý²»ÄÜÖض¨Î»£¬°²×°µ½ÁíÒ»¸öĿ¼µÄÔ­ ......

ÔÚDreamweaver+WampServer µ÷ÊÔPHP³ÌÐò

°²×°WAPMServ5.2.6ºó,ÓÃDreamweaver¿ÉÒÔ±àдºÍµ÷ÊÔPHP
Ê×ÏÈ£ºÒªÏÈÆôwapmserver,Æô¶¯ËùÓзþÎñ
È»ºó £ºÔÚDreamweaverÅäÖÃÕ¾µã£¬¾ßÌå²Ù×÷ÈçÏ£º
ÃèÊöϹؼüµÄ²½Ö裺
Ïȵý¨¸öÕ¾µã È»ºó
¸ß¼¶ Ñ¡Ï£º
·ÖÀࣺ±¾µØÐÅÏ¢
±¾µØ¸ùÎļþ¼Ð £¨Ñ¡ÔñPHPµÄ·¢²¼Îļþ¼Ð£©
Á´½ÓÏà¶ÔÓÚ Õ¾µã¸ùĿ¼
HTTPµØÖ· Http://localhost/
»º´æ Æ ......

ת phpµÄÃæÊÔÌâ

תÔصÄPHPÃæÊÔÌâ
1. »ù±¾ÖªÊ¶µã
HTTPЭÒéÖм¸¸ö״̬ÂëµÄº¬Òå:503 500 401 200 301 302¡£¡£¡£
Include require include_once require_once µÄÇø±ð.
PHP/MysqlÖм¸¸ö°æ±¾µÄ½ø»¯Ê·£¬±ÈÈçmysql4.0µ½4.1£¬PHP 4.xµ½5.1µÄÖØ´ó¸Ä½øµÈµÈ¡£
HEREDOC½éÉÜ
д³öһЩphpħ»Ã·½·¨;
һЩ±àÒëphpʱµÄconfigure ²ÎÊý
Ïòphp´«Èë ......

PHP¶à½ø³ÌЭ×÷±à³ÌÖ® popen

ʹÓÃ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);
}
?> ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ