Home > Backend Development > PHP Tutorial > str_replaced函数的有关问题

str_replaced函数的有关问题

WBOY
Release: 2016-06-13 12:24:31
Original
769 people have browsed it

str_replaced函数的问题?

<br />$bodytext = str_replace("%body%", "black", "<body text='%body%'>");<br />var_dump($bodytext);<br />echo str_replace("world","John","Hello world!");<br />
Copy after login

输出

为什么var_dump($bodytext)会输出string(19) "";是那里错了?设置还是语法?
------解决思路----------------------
$bodytext = str_replace("%body%", "black", "<body text='%body%'>");<br />var_dump($bodytext);
Copy after login
string(19) "

"

你只看到 string(19) ""  的原因是:你用浏览器查看时, 被当做 html 标记解释了,所以看不见
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template