天天看點

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__) . '<br />';
echo $root_path;
exit;