¶¨Òåphp³£Á¿
³£Á¿¿ÉÒÔÀí½âΪֵ²»±äµÄ±äÁ¿¡£³£Á¿Öµ±»¶¨Òåºó£¬Ôڽű¾µÄÆäËûÈκεط½¶¼²»Äܱ»¸Ä±ä¡£Ò»¸ö³£Á¿ÓÉÓ¢ÎÄ×Öĸ¡¢Ï»®Ïß¡¢ºÍÊý×Ö×é³É£¬µ« Êý×Ö²»ÄÜ×÷ΪÊ××Öĸ³öÏÖ¡£
ÔÚphpÖÐʹÓÃdefaine()º¯ÊýÀ´¶¨Òå³£Á¿£¬¸Ãº¯ÊýµÄÓï·¨¸ñʽΪ£º
define(string constant_name, mixed value, case_sensitive = true)
¸Ãº¯ÊýÓÐ3¸ö²ÎÊý£º
constant_name:±ØÑ¡²ÎÊý£¬³£Á¿Ãû³Æ,¼´±êÖ¾·û
value:±ØÑ¡²ÎÊý£¬³£Á¿µÄÖµ
case_sensitive:¿ÉÑ¡²ÎÊý£¬Ö¸¶¨ÊÇ·ñ´óСдÃô¸Ð£¬É趨Ϊtrue±íʾ²»Ãô¸Ð
»ñÈ¡³£Á¿ÖµÓÐÁ½ÖÖ·½·¨£º
1.ʹÓó£Á¿ÃûÖ±½Ó»ñȡֵ£»
2.ʹÓÃconstant()º¯Êý¡£
constant()º¯ÊýºÍÖ±½ÓʹÓó£Á¿ÃûÊä³öµÄЧ¹ûÊÇÒ»ÑùµÄ£¬µ«º¯Êý¿ÉÒÔ¶¯Ì¬µÄÊä³ö²»Í¬µÄ³£Á¿£¬ÔÚʹÓÃÉÏÒªÁé»î¡¢·½±ã¡£
Óï·¨¸ñʽΪ£º
mixed constant(string constant_name)
²ÎÊýconstant_nameΪҪ»ñÈ¡³£Á¿µÄÃû³Æ£¬Ò²¿ÉΪ´æ´¢³£Á¿ÃûµÄ±äÁ¿¡£
Èç¹û³É¹¦Ôò·µ»Ø³£Á¿µÄÖµ£¬Ê§°ÜÔòÌáʾ´íÎóÐÅÏ¢³£Á¿Ã»Óб»¶¨Òå¡£
ÒªÅжÏÒ»¸ö³£Á¿ÊÇ·ñÒѾ¶¨ÒåʹÓÃdefined()º¯Êý¡£º¯ÊýµÄÓï·¨¸ñʽΪ£º
bool defained(string constants_name)
constant_nameΪҪ»ñÈ¡³£Á¿µÄÃû³Æ£¬´æÔÚÔò·µ»Øtrue£¬·ñÔò·µ»Øfalse;
phpÖпÉÒÔʹÓÃÔ¤¶¨Òå³£Á¿»ñÈ¡phpÖеÄÐÅÏ¢¡£Èç"_FILE_"¡¢"_LINE_"¡¢"PHP_OS"µÈµÈ¡£
Àý£º
<?php
define ("MESSAGE", "PHP³£Á¿¶¨Òå,³£Á¿ÃûÇø±ð´óСд");
echo MESSAGE."<br/>"; //Êä³ö³£Á¿MESSAGE
echo Message."<br/>"; //Êä³ö"Message"£¬±íʾûÓиó£Á¿
define("MESSAGE2", "PHP³£Á¿¶¨Òå,³£Á¿Ãû²»Çø±ð´óСд", true);
echo MESSAGE2."<br/>"; //Êä³ö³£Á¿MESSAGE2
echo Message2."<br/>"; //Êä³ö³£Á¿
$constant_name = "message2";
echo constant($constant_name)."<br/>"; //Êä³ö³£Á¿MESSAGE2
echo defined("MESSAGE")."<br/>"; //Èç¹û¶¨Òå·µ»Øtrue,echoÊä³öÏÔʾ1
?>
Ïà¹ØÎĵµ£º
PayPal ¿ìËÙ¡¢°²È«¶øÓÖ·½±ã£¬ÊÇ¿ç¹ú½»Ò×µÄÊ×Ñ¡ÔÚÏ߸¶¿î·½Ê½¡£ÏÖÔÚPayPal¿ÉÒԺ͹úÄڴ󲿷ÖÐÅÓÿ¨¹ØÁª,¿ÉÒÔʵÏÖ¹úÈ˵Ŀç¹ú½»Ò×ÊÕÖ§¡£
ÉêÇëPayPal×¢²áÍøÖ·£ºhttps://www.paypal.com/
paypal½Ó¿ÚÓëÆäËü½Ó¿ÚÓÐЩ²»Í¬£¬ÉÔ΢¸´ÔÓÒ»µã¡£ ÆäÊµÒøÐнӿÚÒ²ËãÊÇÒ»¸öÕ¾µãµÄ²å¼þ¡£
Ëùνpaypal ipn£¨Instant Payment Notification£©£¬¾Í ......
iconvº¯Êý¿âÄܹ»Íê³É¸÷ÖÖ×Ö·û¼¯¼äµÄת»»£¬ÊÇphp±à³ÌÖв»¿ÉȱÉٵĻù´¡º¯Êý¿â¡£
1¡¢ÏÂÔØlibiconvº¯Êý¿âhttp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.9.2.tar.gz£»
2¡¢½âѹËõtar -zxvf libiconv-1.9.2.tar.gz;
3¡¢°²×°libiconv
££configure --prefix=/usr/local/iconv
#make
#make install
4¡¢ÖØÐ±àÒëphp Ô ......
Ê×ÏÈ£¬½¨InnoDBÀàÐÍµÄ±í£¬²ÅÄÜÖ§³ÖÊÂÎñ
$handler = mysql_connect('localhost', '', '');
mysql_select_db('test');
mysql_query('SET AUTOCOMMIT=0'); // ÉèÖÃΪ²»×Ô¶¯Ìá½»²éѯ
mysql_query('START TRANSACTION'); // ¿ªÊ¼²éѯ£¬ÕâÀïÒ²¿ÉÒÔʹÓÃBEGIN
mysql_query("INSERT INTO users VALUES ('ccc')");
mysql_query( ......
ÎÒÃÇÖªµÀÔÚPHP4ÀïÃæ£¬µ±ÎÒÃÇʹÓÃÒ»¸öÀàµÄʱºò£¬±ØÐ뽫¸ÃÀàËùÒÔÎļþʹÓÃinclude»òrequire¼Ó½øÀ´£¬ÕâÑùÎÒÃǾͿÉÒÔʹÓÃÀàÁË¡£
¶ø¶ÔÓÚPHP5À´ËµÒ²¿ÉÒÔʹÓÃÔÚPHP4ÀïÃæµÄ·½Ê½£¬½«ÀàÎļþ°ü½øÀ´£¬µ«µ±ÓÐÁË__autoloadÖ®ºó£¬ÕâÖÖÇé¿ö¾Í¿ÉÒÔ¿¿±àд¹æÔòҲʵÏÖ¡£
ÒÔÏ´úÂ룺
<?php
$obj_A = new clsA();
......