0

I've tried this one <?php $previous_page = $_SERVER['HTTP_REFERER']; ?>

and the result is http://localhost/index.php

how can i get only index.php

sandros
  • 3
  • 4

1 Answers1

0
$previous_page = $_SERVER['HTTP_REFERER'];
$path_parts = pathinfo($previous_page);
$result = $path_parts['basename']; //index.php

https://www.php.net/manual/en/function.pathinfo.php

hakki
  • 6,181
  • 6
  • 62
  • 106