简体   繁体   English

如何在PHP中删除URL参数字符串的一部分

[英]How to remove a part of a URL argument string in php

Why does this not remove the example/ : 为什么这不能删除example/

$url = "http://webserver/exmaple/subdomaine/";
$domaine="example"
$domaine= $domaine."/";
echo str_replace($domaine,"",$url);

Is there a better way to do so ? 有更好的方法吗?

Thanks! 谢谢!

$domaine = "example"; // Missing semicolon ...

Check spelling: 检查拼写:

exmaple !== example exmaple !== example

exmaple would be a tree that was a maple in the past but is now another type of tree such as an oak or yew. exmaple会是一棵过去曾经是枫树的树,但现在是另一种树,例如橡树或紫杉。

did a mistake here 在这里犯了一个错误

$domaine="example"

replace it by 替换为

$domaine="example";

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

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