从url替换特定值[重复]

This question already has an answer here:

I want to replace '/50' with URL.my URL is

http://localhost/CI/admin/pcustomer/cprofile/50?customer=18267&mobile=&nearby=

I want url as

http://localhost/CI/admin/pcustomer/cprofile?customer=18267&mobile=&nearby=
</div>

From that little info in your question, this seems to be the simplest way to achieve "I want to replace '/50' with URL"

$url = str_replace('/50', '', 'http://localhost/CI/admin/pcustomer/cprofile/50?customer=18267&mobile=&nearby=');