位置: 编程技术 - 正文

PHP:file_exists()的用法_Filesystem函数(php files)

编辑:rootadmin
file_exists

推荐整理分享PHP:file_exists()的用法_Filesystem函数(php files),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:php的file_get_contents,php_fileinfo,php file,php filetype,php is_file,php的file_get_contents,php_fileinfo,php_fileinfo,内容如对您有帮助,希望把文章链接给更多的朋友!

(PHP 4, PHP 5)

file_exists — 检查文件或目录是否存在

说明 bool file_exists ( string $filename )

检查文件或目录是否存在。

参数

filename

文件或目录的路径。

在 Windows 中要用 //computername/share/filename 或者 \computernamesharefilename 来检查网络中的共享文件。

返回值

如果由 filename 指定的文件或目录存在则返回 TRUE,否则返回 FALSE。

Note:

This function will return FALSE for symlinks pointing to non-existing files.

Warning PHP:file_exists()的用法_Filesystem函数(php files)

如果因为安全模式的限制而导致不能访问文件的话,该函数会返回 FALSE。然而,可以使用 include 来包含,如果文件在 safe_mode_include_dir 所指定的目录里。

Note:

The check is done using the real UID/GID instead of the effective one.

Note:因为 PHP 的整数类型是有符号整型而且很多平台使用 位整型,对 2GB以上的文件,一些文件系统函数可能返回无法预期的结果 。

范例

Example #1 测试一个文件是否存在

<?php$filename='/path/to/foo.txt';if(file_exists($filename)){echo"Thefile$filenameexists";}else{echo"Thefile$filenamedoesnotexist";}?>

错误/异常

失败时抛出E_WARNING警告。

注释

Note: 此函数的结果会被缓存。参见clearstatcache() 以获得更多细节。

Tip

自 PHP 5.0.0 起, 此函数也用于某些URL 包装器。请参见 支持的协议和封装协议以获得支持 stat() 系列函数功能的包装器列表。

参见

is_readable() - 判断给定文件名是否可读 is_writable() - 判断给定的文件名是否可写 is_file() - 判断给定文件名是否为一个正常的文件 file() - 把整个文件读入一个数组中

PHP:filectime()的用法_Filesystem函数 filectime(PHP4,PHP5)filectime取得文件的inode修改时间说明intfilectime(string$filename)取得文件的inode修改时间。参数filename文件的路径。返回值返回文件上次inode被

PHP:fileatime()的用法_Filesystem函数 fileatime(PHP4,PHP5)fileatime取得文件的上次访问时间说明intfileatime(string$filename)取得文件的上次访问时间。参数filename文件的路径。返回值返回文件上次被访

PHP:fgetcsv()的用法_Filesystem函数 fgetcsv(PHP4,PHP5)fgetcsv从文件指针中读入一行并解析CSV字段说明arrayfgetcsv(resource$handle[,int$length=0[,string$delimiter=,[,string$enclosure=[,string$escape=\]]]])和fgets()类似

本文链接地址:https://www.jiuchutong.com/biancheng/285225.html 转载请保留说明!

上一篇:PHP:fileinode()的用法_Filesystem函数(php_fileinfo作用)

下一篇:PHP:filectime()的用法_Filesystem函数(file php)

免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

鄂ICP备2023003026号

网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

友情链接: 武汉网站建设 电脑维修 湖南楚通运网络