Is there a way for php to know the way?

I can use $_ SERVER ["HTTP_HOST"] to know the current web address
and also $_ SERVER [" PHP_SELF"] to know which file I am loading now
for example, when I am in index.php
, he will show / index.php
if I am in admin/index.php
, he will show / admin/index.php
what I want to implement is

.

run a script as long as there is a / admin/*.php on the road
, but how can I tell if it is down under / admin/*.php?
how do I catch / admin/ ? Do not decide which .php, just judge the file name before it

PS I want to use the basename (_ _ FILE__) series, but my local side is one location, and the server side is another, so I have to make multiple decisions, which is not easy to use. _ SERVER is the most monotonous, skipping the root root directory directly, but it doesn"t have the function of just grabbing files.

Mar.29,2021


if(preg_match('-sharp/admin/-sharp',$_SERVER['SCRIPT_NAME'])) {
    echo 'admin';
}

if you are jumping to the specified php file, refer to the nginx redirect configuration. If you want to execute a specific function before or after execution of the requested php file, match url

before entry or end
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3e54f-2b149.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3e54f-2b149.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?