且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP删除字符串中的字符

更新时间:2023-01-22 20:08:40

我认为***只使用 str_replace ,如手册​​中所述:

I think that it's better to use simply str_replace, like the manual says:

如果您不需要花哨的替换 规则(例如正则表达式), 应该始终使用此功能 而不是ereg_replace()或 preg_replace().

If you don't need fancy replacing rules (like regular expressions), you should always use this function instead of ereg_replace() or preg_replace().

<?
$badUrl = "http://www.site.com/backend.php?/c=crud&m=index&t=care";
$goodUrl = str_replace('?/', '?', $badUrl);