Monday, 15 August 2011

php - How to remove part of the url ratther than the shop url from the currently fetched web page url -



php - How to remove part of the url ratther than the shop url from the currently fetched web page url -

in prestashop shop have fetched current web page url using below php code.

<?php $url="http://".$_server['http_host'].$_server['request_uri']; echo $url; ?>

my current echo url http://shoppingworld.com/int/mens-tshirts/fashion.html

my shop url http://shoppingworld.com/int/

i need remove url portion coming next above shop url.

you can't straight partial url.

try this,

$url = 'http://shoppingworld.com/int/mens-tshirts/fashion.html'; $parsed = parse_url($url); $path_array = explode('/', $parsed['path']); echo $parsed['scheme'] . '//' . $parsed['host'] .'/'. $path_array[1] . '/';

demo

php prestashop

No comments:

Post a Comment