Answer the question
In order to leave comments, you need to log in
How to select the last part of a link via PHP?
How can I make the given PHP code output only the last part of the current page link?
For example, the link of the current page site.ru/alias/path/cut-me
Required to display only cut-me
<?php
$url = $_SERVER['REQUEST_URI'];
$url = explode('?', $url);
$url = $url[0];
echo $url;
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question