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

¶¨Òå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
 ?>


Ïà¹ØÎĵµ£º

PHPÊý¾Ý¿âÊÂÎñ´¦Àí

ÔÚʹÓÃphpÖÐʹÓÃÊý¾Ý¿âÊÂÎñ´¦Àí²¢²»¸´ÔÓ£¬Ö÷ÒªÓõ½µÄÊÇmysqliÀàµÄ3¸ö³ÉÔ±º¯Êý¡£
£¨1£©autocommit£¨bool mode£©£¬ÉèÖÃÊý¾Ý¿â×Ô¶¯Ìύ״̬¡£µ±modeΪTRUEʱ£¬´ò¿ª×Ô¶¯Ìá½»ÉèÖ㬵±modeΪFASLEʱ£¬¹Ø±Õ×Ô¶¯ÉèÖá£Ëùν×Ô¶¯Ìá½»£¬¾ÍÊÇMYSQLÿִÐÐÒ»ÌõSQLÓï¾ä£¬¸ÃSQLÓï¾äµÄÖ´Ðнá¹ûÂíÉÏÉúЧ¡£¶ø·Ç×Ô¶¯Ìύʱ£¬ÔòÖ´Ðнá¹ûÒªÒ»Ö±µ½ ......

php±àÂëת»»×ܽá

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 Ô ......

php mysql»Ø¹öʾÀý

Ê×ÏÈ£¬½¨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( ......

php Öеĵ¥ÒýºÅ Ë«ÒýºÅ ·´ÒýºÅµÄ×÷ÓÃ

×Ö·û´®µÄд·¨
×Ö·û´®ÒÔµ¥¡¢Ë«»òµ¹ÒýºÅΧס·Ö±ðÓв»Í¬µÄÒåÒâ¡£
µ¥ÒýºÅ
ÀýÈ磺
$str = 'An apple a day keeps the docter away.'
µ±×Ö·û´®³öÏÖ ' ·ûºÅʱ£¬±ØÐë¼ÓÉÏ£º
'I'm wing'
Ó¦¸Ä³É£º
'I'm wing'
²Å¶Ô£¬ÆäÖÐ ' ¼´³ÆÎªÌøÍÑ×Ö·û (escape character)¡£
Ë«ÒýºÅ
ÒÔË«ÒýºÅΧסµÄ×Ö·û´® PHP »á¶Ô¸Ã×Ö·û´®× ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ