关于STR REPLACE 不能替换多个字符的有关问题 求解

WBOY
Release: 2016-06-13 13:20:11
Original
865 people have browsed it

关于STR REPLACE 不能替换多个字符的问题 求解
我用STR REPLACE 替换 例如第一个
echo "$uri/view/".trim(str_replace ( '%0A', '', rawurlencode($line))).'.html
帮%0A 替换成空 这个替换正常 而我现在需要一次性替换多个
代码如下
echo "$uri/view/".trim(str_replace (array("%0A",''),array("%0D",''), rawurlencode($line))).'.html
%0A 替换成空 成功 但是后面的替换%0D 却失效 求解
如何让这个代码 同时替换两个字符呢

------解决方案--------------------
echo "$uri/view/".trim(str_replace (array("%0A","%0D"),"", rawurlencode($line))).'.html
------解决方案--------------------
str_replace (array("%0A",''),array("%0D",''), rawurlencode($line))
=>
strtr (rawurlencode($line), array("%0A"=>'',"%0D"=>''))

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!