$path = "/home/httpd/html/index.php"; $file = basename($path); // $file is set to "index.php" $file = basename($path,".php"); // $file is set to "index"
dirname:
$path = "/etc/passwd"; $file = dirname($path); // $file is set to "/etc"
一个是取出目录名
一个是取出文件名