当前位置: 首页 > 网络学院 > 服务端脚本教程 > PHP > PHP Filesystem

PHP
PHP 安全邮件
MySQL 介绍
连接 MySQL
创建 MySQL
MySQL 插入记录
MySQL 选择记录
MySQL Where
MySQL Order By
MySQL 记录更新
MySQL 删除记录
PHP ODBC
XML Expat Parser
XML SimpleXML
PHP 数组参考
PHP Calendar
PHP Date
PHP Directory
PHP Filesystem
PHP FTP
PHP HTTP

PHP Filesystem


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 898 ::
收藏到网摘: n/a

PHP Filesystem Introduction
PHP文件系统介绍

The filesystem functions allow you to access and manipulate the filesystem.
文件系统函数用于访问和操纵


Installation
安装

The filesystem functions are part of the PHP core. There is no installation needed to use these functions.
本函数库作为 PHP 内核的一部分,不用安装就能使用。


Runtime Configuration
运行时配置

The behavior of the filesystem functions is affected by settings in php.ini.
这些函数的行为受 php.ini 的影响。

Filesystem configuration options:
文件系统和流配置选项

Name
名称
Default
默认值
Description
说明
Changeable
可修改范围
allow_url_fopen "1"

Allows fopen()-type functions to work with URLs (available since PHP 4.0.4)
使得fopen()可以访问 URL 对象例如文件。(自PHP 4.0.4)

PHP_INI_SYSTEM
user_agent NULL Defines the user agent for PHP to send (available since PHP 4.3)
定义 PHP 发送的 User-Agent。(自PHP 4.3)
PHP_INI_ALL
default_socket_timeout "60" Sets the default timeout, in seconds, for socket based streams (available since PHP 4.3)
基于 socket 的流的默认超时时间(秒)。 (自PHP 4.3)
PHP_INI_ALL
from "" Defines the anonymous FTP password (your email address)
定义匿名 ftp 的密码(email 地址)。
PHP_INI_ALL
auto_detect_line_endings "0" When set to "1", PHP will examine the data read by fgets() and file() to see if it is using Unix, MS-Dos or Mac line-ending characters (available since PHP 4.3)
当设为 On 时,PHP 将检查通过 fgets() 和 file() 取得的数据中的行结束符号是符合 Unix,MS-Dos,还是 Macintosh 的习惯。(自PHP 4.3)
PHP_INI_ALL


Unix / Windows Compatibility
Unix / Windows 兼容性

When specifying a path on Unix platforms, the forward slash (/) is used as directory separator. However, on Windows platforms, both forward slash (/) and backslash () can be used.
在Unix平台上,路径中使用正斜杠(/)作为目录分隔符;在Windows平台上正(/)反()斜杠均可。


PHP Filesystem Functions
PHP文件系统函数

PHP: indicates the earliest version of PHP that supports the function.
PHP:最早支持这些函数的PHP版本

Function
函数
Description
说明
PHP
basename() Returns the filename component of a path
返回路径中的文件名部分
3
chgrp() Changes the file group
改变文件所属的组
3
chmod() Changes the file mode
改变文件模式
3
chown() Changes the file owner
改变文件的所有者
3
clearstatcache() Clears the file status cache
清除文件状态缓存
3
copy() Copies a file
拷贝文件
3
delete() See unlink() or unset()
删除文件. (Also see unlink() or unset())
参见unlink()或unset()
 
dirname() Returns the directory name component of a path
返回路径中的目录部分
3
disk_free_space() Returns the free space of a directory
返回目录中的可用空间
4
disk_total_space() Returns the total size of a directory
返回一个目录的磁盘总大小
4
diskfreespace() Alias of disk_free_space()
disk_free_space()的别名
3
fclose() Closes an open file
关闭一个已打开的文件指针
3
feof() Tests for end-of-file on an open file
测试文件指针是否到了文件结束的位置
3
fflush() Flushes buffered output to an open file
将缓冲内容输出到文件
4
fgetc() Returns a character from an open file
从文件指针中读取字符
3
fgetcsv() Parses a line from an open file, checking for CSV fields
查找CSV域,从一个打开的文件中找出所有词段[每段用“,”隔开],然后以数组的形式输出它们
3
fgets() Returns a line from an open file
从文件指针中读取一行
3
fgetss() Returns a line, with HTML and PHP tags removed, from an open file
从一个打开的文件中返回不包含HTML和PHP标签的一行
3
file() Reads a file into an array
把整个文件读入一个数组中
3
file_exists() Checks whether or not a file or directory exists
检查文件或目录是否存在
3
file_get_contents() Reads a file into a string
将整个文件读入一个字符串
4
file_put_contents Writes a string to a file
将一个字符串写入文件
5
fileatime() Returns the last access time of a file
取得文件的最后访问时间
3
filectime() Returns the last change time of a file
取得文件的inode修改时间
3
filegroup() Returns the group ID of a file
取得文件的组
3
fileinode() Returns the inode number of a file
取得文件的inode
3
filemtime() Returns the last modification time of a file
取得文件修改时间
3
fileowner() Returns the user ID (owner) of a file
取得文件的所有者
3
fileperms() Returns the permissions of a file
取得文件的权限
3
filesize() Returns the file size
取得文件大小
3
filetype() Returns the file type
取得文件类型
3
flock() Locks or releases a file
轻便的咨询文件锁定
3
fnmatch() Matches a filename or string against a specified pattern
用模式匹配文件名
4
fopen() Opens a file or URL
打开文件或者URL
3
fpassthru() Reads from an open file, until EOF, and writes the result to the output buffer
读取一个已打开文件的内容,直到文件的末尾[EOF]并将结果写入输出缓冲器[output buffer]
3
fputcsv() Formats a line as CSV and writes it to an open file
将行格式化为CSV并写入文件指针
5
fputs() Alias of fwrite()
fwrite()的别名
3
fread() Reads from an open file
读取文件(可安全用于二进制文件)
3
fscanf() Parses input from an open file according to a specified format
从文件中格式化输入
4
fseek() Seeks in an open file
在文件指针中定位
3
fstat() Returns information about an open file
通过已打开的文件指针取得文件信息
4
ftell() Returns the current position in an open file
返回文件指针读/写的位置
3
ftruncate() Truncates an open file to a specified length
将文件截断到给定的长度
4
fwrite() Writes to an open file
写入文件(可安全用于二进制文件)
3
glob() Returns an array of filenames / directories matching a specified pattern
寻找与模式匹配的文件名或目录
4
is_dir() Checks whether a file is a directory
判断给定文件名是否是一个目录
3
is_executable() Checks whether a file is executable
判断给定文件名是否可执行
3
is_file() Checks whether a file is a regular file
判断给定文件名是否为一个正常的文件
3
is_link() Checks whether a file is a link
判断给定文件名是否为一个符号连接
3
is_readable() Checks whether a file is readable
判断给定文件名是否可读
3
is_uploaded_file() Checks whether a file was uploaded via HTTP POST
判断文件是否是通过HTTPPOST上传的
3
is_writable() Checks whether a file is writeable
判断给定的文件名是否可写
4
is_writeable() Alias of is_writable()
is_writable()的别名
3
link() Creates a hard link
建立一个硬连接[hard link]
3
linkinfo() Returns information about a hard link
获取一个硬连接的信息
3
lstat() Returns information about a file or symbolic link
给出文件的信息 or symbolic link
给出一个文件或符号连接的信息
3
mkdir() Creates a directory
新建目录
3
move_uploaded_file() Moves an uploaded file to a new location
将上传的文件移动到新位置
4
parse_ini_file() Parses a configuration file
解析一个配置文件
4
pathinfo() Returns information about a file path
给出文件的信息 path
返回文件路径的信息
4
pclose() Closes a pipe opened by popen()
关闭进程文件指针
3
popen() Opens a pipe
打开进程文件指针
3
readfile() Reads a file and writes it to the output buffer
输出一个文件
3
readlink() Returns the target of a symbolic link
返回符号连接指向的目标
3
realpath() Returns the absolute pathname
返回规范化的绝对路径名
4
rename() Renames a file or directory
重命名一个文件或目录
3
rewind() Rewinds a file pointer
倒回文件指针的位置
3
rmdir() Removes an empty directory
删除目录
3
set_file_buffer() Sets the buffer size of an open file
stream_set_write_buffer()的别名,为一个打开的文件设置缓冲的空间大小
3
stat() Returns information about a file
给出文件的信息
3
symlink() Creates a symbolic link
建立符号连接
3
tempnam() Creates a unique temporary file
建立一个临时文件
建立一个具有唯一文件名的文件
3
tmpfile() Creates a unique temporary file
建立一个临时文件
建立一个具有唯一文件名的文件
3
touch() Sets access and modification time of a file
设定文件的访问和修改时间
3
umask() Changes file permissions for files
改变当前的umask
3
unlink() Deletes a file
删除文件
3


PHP Filesystem Constants
PHP文件系统常量

PHP: indicates the earliest version of PHP that supports the constant.
PHP:最早支持这些常量的PHP版本

Constant
常量
Description
说明
PHP
GLOB_BRACE    
GLOB_ONLYDIR    
GLOB_MARK    
GLOB_NOSORT    
GLOB_NOCHECK    
GLOB_NOESCAPE    
PATHINFO_DIRNAME    
PATHINFO_BASENAME    
PATHINFO_EXTENSION    
FILE_USE_INCLUDE_PATH    
FILE_APPEND    
FILE_IGNORE_NEW_LINES    
FILE_SKIP_EMPTY_LINES    

评论 (0) All

登陆 | 还没注册?