Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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µÄ½Å±¾ÀïÖ±½Ó½¨Á¢mysqlÀïµÄÊý¾Ý¿â

 ÎÊ£º
±ÈÈçÎÒÏëÖ±½ÓÔÚphp µÄ½Å±¾Àïдһ¸öÀàËÆ£¬install.phpµÄ½Å±¾
Õâ¸ö½Å±¾µÄ×÷ÓþÍÊÇ£¬Á¬½ÓmysqlÊý¾Ý¿â£¬²¢½¨Á¢ÎÒËùÏëÒª½¨Á¢µÄÊý¾Ý¿â£¬Êý¾Ý±í£¬ÒÔ¼°Ïà¹Ø×ֶΡ£
Çë¾ßÌåдһ¸öÀý×Ó£¬Ð»Ð»£¡
______________________________________________________________________________________________
´ð1£º
連½Ó·½· ......

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

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

php¶ÁÈ¡±ê×¼ÊäÈëµÄ·½Ê½

 ÎÒ´òËãÔÚÃüÁîÐÐÖÐÕâÑùµ÷ÓÃphp£º cat filename|php a.php£¬ÈÃa.php¶ÁÈ¡filenameÀïÃæµÄÿÐмǼ½øÐд¦Àí£¬·½·¨ÈçÏ£º
<?php
$fp = fopen("/dev/stdin", "r");
while($input = fgets($fp, 10000))
{
   echo urldecode($input);
}
?>
......

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

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

PHPѧϰ±Ê¼Ç

1.Ö±½ÓʹÓÃmysql_insert_id()»ñÈ¡ÉÏÒ»´Î²åÈëµÄÊý¾ÝµÄAUTO_INCREMENTµÄ±äÁ¿µÄ±àºÅ£¬±ÈʹÓÃmysqlÓï¾ä»ñÈ¡·½±ã¼«¶à¡£µ«×¢ÒâÒªÔÚquery()ºóÁ¢¿ÌʹÓ㬱£Ö¤Ê±¼äÕýÈ·ÐÔ£¬Èç¶àÏ̷߳ÃÎÊÊý¾Ý¿âÊDzúÉúÎó²î¡£
2.µÈºÅ×óÓÒ¸÷ÁôÒ»¿Õ¸ñ£¬ÇåÎú±ãÓÚÔĶÁ¡£
3.PHPÖУ¬µ¥Ë«ÒýºÅ¾ù¿ÉÒÔÌ×string£¬Çø±ðÔÚÓÚ£º
"this is a simple $test" = 'this i ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ