WordPress企业主题定制/开发/优化

PHP str_replace函数使用方法

首页 » PHP » PHP str_replace函数使用方法

PHP str_replace函数使用方法

str_replace

(PHP3 >= 3.0.6 , PHP4)

str_replace ---  取代所有在字符串中出现的字符串

语法 : string str_replace (string needle, string str, string haystack)

说明 :

此函数将所有在参数 haystack中出现的 needle以参数 str取代。如果你不需要这个取代的规则,你可以使用ereg_replace( )来代替此函数。

Example :

<?php

$bodytag = str_replace ("%body%", "black", "<body text=%body%>");

?>

注意 : 此函数是PHP 3.0.6中新增的函数

分类与标签:

PHP

,

相关项目

  • WordPress外贸企业主题

  • 最近更新

  • 热门标签