Question : how to cut string url in php
Answered by : kuldip-ramdham
$url = parse_url('http://example.com/project/controller/action/param1/param2');
Array
( [scheme] => http [host] => example.com [path] => /project/controller/action/param1/param2
)
Source : https://sodocumentation.net/php/topic/10847/how-to-break-down-an-url | Last Update : Fri, 19 Aug 22
Question : how to cut string url in php
Answered by : kuldip-ramdham
$url = parse_url('http://example.com/project/controller/action/param1/param2');
$url['sections'] = explode('/', $url['path']);
Array
( [scheme] => http [host] => example.com [path] => /project/controller/action/param1/param2 [sections] => Array ( [0] => [1] => project [2] => controller [3] => action [4] => param1 [5] => param2 )
)
Source : https://sodocumentation.net/php/topic/10847/how-to-break-down-an-url | Last Update : Fri, 19 Aug 22
Question : how to cut string url in php
Answered by : kuldip-ramdham
$last = end($url['sections']);
Source : https://sodocumentation.net/php/topic/10847/how-to-break-down-an-url | Last Update : Fri, 19 Aug 22