开发者

getting rid of the ending of the url

开发者 https://www.devze.com 2023-01-09 05:23 出处:网络
I am using php and i want the part of the url without the /floor-plans/dsafasd so i want something/whatever

I am using php and i want the part of the url without the /floor-plans/dsafasd so i want something/whatever

instead of

someth开发者_运维百科ing/whatever/floor-plans/dsafasd


$url = preg_replace("#/floor-plan.*#i","",$url);

should do the trick then.


If you're just trying to remove "floor-plans" you could use str_replace().

If it's always the 6th item in the URL, you could explode the url inton an array and then reassemble the pieces you'd like (removing the 5th item in this case since you start a 0 = "wiki")

If it's a regex thing, you'll need to provide more or a pattern to help someone build it...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号