Rumah > Artikel > pembangunan bahagian belakang > str_replaced函数的问题?
$bodytext = str_replace("%body%", "black", "<body text='%body%'>");var_dump($bodytext);echo str_replace("world","John","Hello world!");
$bodytext = str_replace("%body%", "black", "<body text='%body%'>");var_dump($bodytext);string(19) ""
谢谢
应该要用字符实体表示,输出的值为空,是浏览器把它当成一个html标签了:
$bodytext = str_replace("%body%", "black", "1536d9fa4d8ecd51f224648278b5384b");
var_dump($bodytext);
echo str_replace("world","John","Hello world!");
不知道您是不是指的这个?