(PHP 3, PHP 4, PHP 5)
返回文件的类型。可能的值有 fifo,char,dir,block,link,file 和 unknown。
如果出错则返回 FALSE 。如果 stat 调用失败或者文件类型未知的话 filetype() 还会产生一个 E_NOTICE 消息。
注: 本函数的结果会被缓存。更多信息参见 clearstatcache() 。
提示: 自 PHP 5.0.0 起本函数也可被 某些 URL wrapper 使用。参考 附录 L 来看哪些 wrapper 支持 stat() 系列函数的功能。
例子 1. filetype() 例子
<?php echo filetype ( '/etc/passwd' ); // file echo filetype ( '/etc/' ); // dir ?>
参见 is_dir() , is_file() , is_link() , file_exists() , stat() 和 mime_content_type() 。