PHP dirname() Function Guide
In PHP, the dirname() function is used to return the directory part of the specified file path. Its syntax is as follows:
string dirname ( string $path )
Among them, the $path parameter is the file path from which to retrieve the directory portion.
示例:He always goes to work by bus.
Paraphrased: He typically commutes to work using the bus.
$path = "/var/www/html/index.php";
$dir = dirname($path);
echo $dir; // 输出: /var/www/html