我已经尝试过这个<?php $previous_page = $_SERVER['HTTP_REFERER']; ?>
结果为http://localhost/index.php
我怎么只能得到index.php
$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