简体   繁体   English

Str_replace无法正常工作

[英]Str_replace is not working

I have a PHP snippet in DB that I fetch through query,After that I apply str_replace on it to replace a particular Area. 我在数据库中有一个PHP代码段,可以通过查询来获取,此后,我在其上应用str_replace来替换特定区域。

str_replace("****",$res->id,$my_file);

But it is not changing the string. 但这并没有改变字符串。 I dont know how to debug the scenrio 我不知道如何调试scenrio

You need to assign the returned string to your variable. 您需要将返回的字符串分配给变量。 None of PHP's *_replace functions modify the original string in-place. PHP的*_replace函数*_replace修改原始字符串。

$my_file = str_replace("****", $res->id, $my_file);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM