str_replaced 関数に問題がありますか?
<br />$bodytext = str_replace("%body%", "black", "<body text='%body%'>");<br />var_dump($bodytext);<br />echo str_replace("world","John","Hello world!");<br />
$bodytext = str_replace("%body%", "black", "<body text='%body%'>");<br />var_dump($bodytext);