简体   繁体   中英

How to remove a part of a URL argument string in php

Why does this not remove the 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 would be a tree that was a maple in the past but is now another type of tree such as an oak or yew.

did a mistake here

$domaine="example"

replace it by

$domaine="example";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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