替换字符串有问题吗? [英] something wrong with replace string?
本文介绍了替换字符串有问题吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<?php
$ remove = $ _GET [' HWID'];
str_replace($ _ GET ['hwid']。< br />,,$ str);
?>
它甚至不删除文本...
解决方案
我知道我没有设置为html文件, / div>
假设你有这个文件(无论是从html还是其他形式)都可以这样做:
$ str =HTML文件:
测试
Test1
Test2
Test3;
此功能将从字符串中删除Test2:
$ newstr = str_replace(Test2,,$ str);
有关该功能的更多信息,请查看 here
另外一件事,如果你有< br>
在你的例子中的每一行之后,你也需要做同样的事情。
ok can anyone help me with this:
<?php
$remove = $_GET['hwid'];
str_replace($_GET['hwid']."<br />","",$str);
?>
It doesnt even delete the text...
I Know i dont have it set to the html file i have thats because i don't know how to with this string...
解决方案
Let's say you have this as you retrieved text (whether from html or any other form):
$str="THE HTML FILE:
Test
Test1
Test2
Test3";
this function will remove "Test2" from the string:
$newstr=str_replace("Test2","",$str);
for more information of the function take a look at here
Just one more thing, if you have <br>
after each line in your example, you need to do the same for those too.
这篇关于替换字符串有问题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文