--------------------------------------------------------------------------------
函式:str_replace()
--------------------------------------------------------------------------------
字串处理函式库
str_replace
字串取代。语法: string str_replace(string needle, string str, string haystack);传回值: 字串函式种类: 资料处理
内容说明
本函式将字串 str 代入 haystack 字串中,将所有的 needle 置换成 str。[email protected] (11-Apr-1999) 指出在 PHP 3.0.7 版,本函式有些 bug,而 [email protected] (05-Jun-1999) 补充在 PHP 3.0.8 版本函式就回复正常了。
使用范例
下例将 %body% 以 black 取代<?php
$bodytag = str_replace("%body%", "black", "<body text=%body%>");
echo $bodytag;
?>
参考
ereg_replace() --------------------------------------------------------------------------------
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货