Home  >  Article  >  Backend Development  >  str_replace这句话有什么问题呢。

str_replace这句话有什么问题呢。

WBOY
WBOYOriginal
2016-06-23 14:13:06993browse

$url=str_replace("../crm","fkzdy",$url);这句话有什么错误吗?


回复讨论(解决方案)

没有错误!你遇到了什么问题?

没有错误!你遇到了什么问题? $url里面有../crm,我想替换掉,没起作用。

$url = '../crm/xxx';$url = str_replace("../crm","fkzdy",$url);echo $url;
fkzdy/xxx

$url=str_replace("../crm","fkzdy",$url);这句话有什么错误吗?

这一句本身是没有错误的,但有一点要注意,如果$url是直接从地址栏获取URL的,那你的URL中的“../crm”有没有被解析?

Statement:
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