php - 从 url 替换特定值
问题描述
我想用 URL 替换 '/50'。我的 URL 是
http://localhost/CI/admin/pcustomer/cprofile/50?customer=18267&mobile=&nearby=
我想要网址为
http://localhost/CI/admin/pcustomer/cprofile?customer=18267&mobile=&nearby=
解决方案
从您问题中的那一点信息来看,这似乎是实现“我想用 URL 替换 '/50' ”的最简单方法
$url = str_replace('/50', '', 'http://localhost/CI/admin/pcustomer/cprofile/50?customer=18267&mobile=&nearby=');
推荐阅读
- python-3.x - 为什么多处理不适用于 python dash 框架 - Python3.6
- c - Vala:使用库不起作用:未找到 taglib、tag_c.h
- java - 类型不匹配:必需:上下文,找到:意图
- reactjs - 如何在反应中编写内容属性?
- podman - 如何在不写入主目录的情况下运行 podman 和 buildah?
- python - 我可以使用 python 和美丽的汤将用户定义的搜索词作为几种可能的搜索字段类型之一提交吗?
- python - 使用 matplotlib 绘制和保存图像时如何获得更多 fps
- javascript - 如何在不打开新窗口的情况下将变量传递给 php?
- c# - LINQ 在信息组上不同
- python - RPG文字游戏商店修正