php 获取当前文件名、文件夹名

echo basename(dirname(__FILE__));
exit;

echo $_SERVER['SCRIPT_NAME'];
exit;

function filename(){
	$dir_file = $_SERVER['SCRIPT_NAME'];
	$filename = basename($dir_file);
	echo $filename;
}
filename();
exit;

$root_path = str_replace("\include","",str_replace("\\","/",dirname(__FILE__)));
echo dirname(__FILE__) . '
'; echo $root_path; exit;

你可能感兴趣的:(php 获取当前文件名、文件夹名)