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

PHPÖÐstr_replaceº¯ÊýʹÓÃС½á

 Õâ¶Îʱ¼äÔÚ¿´¡¶PHPºÍMySQL Web¿ª·¢¡·Ò»Êé¿´µ½str_replace½²½â£¬Ò»¶ÎСÌáʾдµ½£º¿ÉÒÔΪstr_replaceµÄÈý¸ö¶¼Ê¹ÓÃÊý×é´«È룬µ«½²½â±È½Ï¼òµ¥£¬ÓÚÊǾö¶¨×Ô¼ºµÄÊÔÑéһϸú¯ÊýÔÚ¸÷¸ö²ÎÊý´«ÈëÊý×éʱµÄÖ´Ðнá¹û¡£
º¯ÊýÔ­ÐÍ£ºmixed str_replace(mixed needle,mixed new_needle,mixed haystack[,int &count]);
needle£ºÒª±»Ìæ»»µÄ×Ö·û´®£¬new_needle£ºÌæ»»ÓõÄ×Ö·û´®£¬haystack£º²Ù×÷×Ö·û´®£¬count£ºÌæ»»´ÎÊý¡¾¿ÉÑ¡²ÎÊý¡¿
ÎÒÃÇÖصãÊÔÑéÇ°Èý¸öÔÚʹÓÃÊý×éÊǵÄÖ´Ðз½Ê½£º
ÔÚ¶¼²»Ê¹ÓÃÊý×éʱ£¬¸Ãº¯ÊýÖ±½ÓʹÓÃnew_needleÌæ»»ËùÓеÄneedle²¢·µ»ØÌæ»»ºóµÄ×Ö·û´®¡£È磺str_replace("m","n","my name is jim!")·µ»Øny nane is jin!
1¡¢Ö»¶ÔneedleʹÓÃÊý×é¡£
ʾÀý£ºstr_replace(array('m','i'),'n',"my name is jim!");·µ»Ø£ºny nane ns jnn!
¿ÉÒÔ¿´³ö£¬º¯Êý˳ÐòÐԵĶÔÊý×éÖÐÿ¸ö×Ö·û´®½øÐÐÌæ»»£¬²¢·µ»ØÌæ»»ºóµÄ×Ö·û´®¡£
2¡¢Ö»¶Ônew_needleʹÓÃÊý×é¡£
ʾÀý£ºstr_replace('m',array('n','z'),"my name is jim!\n")·µ»Ø£ºArrayy naArraye is jiArray!
¸ÃÌæ»»±È½ÏÓÐÒâ˼£¬Èç¹ûÖ»¶ÔµÚ¶þ¸ö²ÎÊýʹÓÃÊý×éÔòº¯Êý½«Æä×÷Ϊ×Ö·û´®Array½øÐÐʹÓ㬽«ËùÓеÄneedleÌ滻ΪÁËÊý×é¡£
3¡¢Ö»¶ÔhaystackʹÓÃÊý×é¡£
ʾÀý£ºstr_replace("m","n",array("my name is jim!","the game is over!"))¸ÃÓï¾äÖ´Ðнá¹û·µ»ØÒ»¸öÊý×飬¼´·Ö±ðΪ´«ÈëµÄÁ½¸ö×Ö·û´®Ìæ»»ºóµÄ½á¹û¡£
Èç¹ûÊä³öÊý×éÄÚÈݻῴµ½£ºny nane is jin! the gane is over!
4¡¢¶ÔneedleºÍnew_needle¶¼Ê¹ÓÃÊý×é¡£
ʾÀý£ºstr_replace(array("m","i"),array("n","z"),"my name is jim!")·µ»Ø£ºny nane zs jzn!
²é¿´Ö´Ðнá¹û¿ÉÒÔ·¢ÏÖ£¬Èç¹ûÇ°Á½¸ö²ÎÊý¶¼Ê¹ÓÃÊý×éÔòº¯Êý°ÑÊý×é¸÷¸ö¶ÔÏóÏî×Ö·û´®½øÐÐÁËÌæ»»£¬¼°needleµÄµÚÒ»ÏîÌ滻Ϊnew_needleµÄµÚÒ»Ïî¡£ÒÔ´ËÀàÍÆ¡£
Èç¹ûneedleÊý×é±Ènew_deedle³¤£¬ÀýÈ磺str_replace(array("m","i","s"),array("n","z"),"my name is jim!");·µ»Ø£ºny nane z jzn!¿É¼û£¬¶ÔÓÚneedleÊý×é¶à³öÀ´µÄ×Ö·û´®±»Ì滻ΪÁË¿Õ´®¡£
Èç¹ûnew_needleÊý×é±Èneedle³¤£¬ÀýÈ磺str_replace(array("m","i"),array("n","z","x"),"my name is jim!")·µ»Øny nane zs jzn!¿É¼ûnew_needle¶àÓàµÄÏî±»ºöÂÔ¡£
5¡¢Èý¸ö²ÎÊý¶¼Ê¹ÓÃÊý×é¡£
ÀýÈ磺str_replace(array("m","i"),array("n","z"),array("my name is jim!","the game is over"))·µ»ØµÄÊý×éÄÚÈÝ£ºny nane zs jzn!the gane zs over
Õâ¸ö±È½


Ïà¹ØÎĵµ£º

³õѧPHPµÄ18¸ö»ù´¡Àý³Ì

 
ÈçºÎ´´½¨ÎÒÃǵĵÚÒ»¸öPHPÒ³ÃæÄØ£¿·Ç³£¼òµ¥µÄ£¡Ñ¡ÔñÎÒÃÇʹÓõÄÒ»¸ö×îºÃµÄÉè¼Æ¹¤¾ß£¬µ±È»ÄãÒ²¿ÉÒÔ Ö»Ê¹ÓüÇʱ¾¡£´´½¨Ö®ºó¼ÇµÃÒª±£´æΪÀ©Õ¹ÃûΪPHPµÄÎļþ£¬È»ºó´«µ½ÎÒÃǵķþÎñÆ÷
ÉÏ¡£
¡¡¡¡ÔÚ±àдPHP³ÌÐò֮ǰͨ³£ÎÒÃÇÐèÒªÅäÖÃÎÒÃǵĻ·¾³£¬Ò²¾ÍÊÇ˵·þÎñÆ÷
ÒªÖ§³ÖPHP²ÅÄÜÐа¡
¡¡¡¡Ò»¡¢PHPµÄ»ù±¾½á¹¹£º
¡¡¡¡Ê¹ÓÃIncl ......

php»ñÈ¡»·¾³ÐÅÏ¢

ϵͳ°æ±¾±È½Ï
mixed version_compare ( string version1, string version2 [, string operator] )
version_compare('5.1','<');  //±È½Ïµ±Ç°°æ±¾ÊÇ·ñСÓÚ5.1
ÊÇ·ñ¿ªÆô×Ô¶¯/
get_magic_quotes_gpc() 
return 1 on: will add slash.
return 0 off:willn't add.
if(get_magic_quotes_gpc()) {
 $cm ......

PHPÊÓƵ½Ì³ÌÏÂÔØ£¨PHP100ϵÁÐÊÓƵ½Ì³Ì£©

PHPÊÓƵ½Ì³ÌÏÂÔØ£¨PHP100ϵÁÐÊÓƵ½Ì³Ì£©
PHP100ÊÇÒ»¸öÕë¶ÔPHP³õѧÕßµÄPHPÊÓƵ½ÌѧÍøÕ¾£¬ÓÐÂù¸ßµÄÈËÆøºÍ»îÁ¦¡£Ä¿Ç°ÍøÉϵÄPHPµÄÊÓƵ×ÊÔ´²¢²»¶à£¬¶àÊý¶¼ÊÇÔÚÓÅ¿áµÈÊÓƵÍøÕ¾ÉϵĽ̳̣¬ÊÓƵ²»ÇåÎú£¬¶øÇÒÒ²²»È«ÃæºÍϵͳ¡£¶øPHP100ÍøÕ¾ÉϵÄϵÁÐÊÓƵ½Ì³Ì£¬ÅäÓпμþ£¬´ÓÈëÃŵ½¾«Í¨£¬ºÜ²»´í£¬»ù±¾±£³ÖÒ»ÖÜÒ»ÆڵĸüÐÂËٶȡ£share it£ ......

[ת]UbuntuÏÂphp¿ª·¢»·¾³ÅäÖÃ(XAMPP)

UbuntuÎÞÒÉÊÇlinux³õѧÕßµÄÊ×Ñ¡°æ±¾£¬ÒòΪËüͼÐνçÃæÖ§³ÖµÄ·Ç³£ºÃ¡£
È»¶øxammpÊÇphp³õѧÕßµÄÊ×Ñ¡¡£
1.ʲôÊÇxammp?
XAMPP£¨Apache+MySQL+PHP+PERL£©ÊÇÒ»¸ö¹¦ÄÜÇ¿´óµÄ½¨Õ¾¼¯³ÉÈí¼þ°ü¡£Õâ¸öÈí¼þ°üÔ­À´µÄÃû×ÖÊÇLAMPP£¬µ«ÊÇΪÁ˱ÜÃâÎó½â£¬×îеļ¸¸ö°æ±¾¾Í¸ÄÃûΪ XAMPP ÁË¡£Ëü¿ÉÒÔÔÚWindows¡¢Linux¡¢SolarisÈýÖÖ²Ù×÷ϵͳÏ°² ......

¼ÌÐøÕª³­£º½ÌÄãÓÃPHPдMySQLÊý¾Ý¿âµÄÓû§ÈÏ֤ϵͳ

Óû§ÈÏÖ¤µÄÔ­ÀíºÜ¼òµ¥£ºÊ×ÏÈÐèÒªÓû§ÔÚÒ³ÃæÉÏÌîÈëÓû§ÃûºÍÃÜÂ룬µ±È»Ã»×¢²áµÄÓû§ÐèÒªÏÈ×¢²á¡£È»ºóµ÷ÓÃÊý¾Ý¿âËÑË÷ÊÇ·ñÓÐÏàÓ¦µÄÓû§¡£Èç¹ûÓоÍÈ·ÈÏ£¬Ã»ÓÐÔòÌáÐÑÓû§ÏÈ×¢²á¡£Ê¹ÓÃPHPÀ´Íê³ÉÕâÒ»Çкܼòµ¥£¬µ«ÐèҪעÒâµÄÊÇÈç¹ûÏëÔÚÒÔºóµÄÒ³ÃæÖж¼ÄÜÈ·ÈÏÓû§Éí·Ý¡£
µÚÒ»²½ÊÇ×öÒ»¸öµÇ¼µÄÒ³Ãæ¡£
µÚ¶þ²½¿ªÊ¼µÇ¼ºóµÄÈ·ÈϳÌÐòµÄÉ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ