fopen()的使用

来源:互联网 发布:mac caj阅读器 编辑:程序博客网 时间:2024/06/01 21:02
fopen(filename,mode,include_path,context)


Parameter参数Description描述
filenameRequired. Specifies the file or URL to open
必要参数。指定需要打开的文件和URL
modeRequired. Specifies the type of access you require to the file/stream.
必要参数。指定需要访问的文件类型

Possible values:
可用值:

  • "r" (Read only. Starts at the beginning of the file)
    “r”(只读格式。始于文件的开头)
  • "r+" (Read/Write. Starts at the beginning of the file)
    “r+”(可读/可写。始于文件的开头)
  • "w" (Write only. Opens and clears the contents of file; or creates a new file if it doesn't exist)
    “w”(只写格式。打开或清除文件的内容;或者创建一个不存在的文件)
  • "w+" (Read/Write. Opens and clears the contents of file; or creates a new file if it doesn't exist)
    “w+”(可读/可写。打开或清除文件的内容;或创建一个不存在的新文件)
  • "a" (Write only. Opens and writes to the end of the file or creates a new file if it doesn't exist)
    “a”(只写格式。打开文件,并在文件的末尾处书写内容;或创建一个新的文件)
  • "a+" (Read/Write. Preserves file content by writing to the end of the file)
    “a+”(可读/可写。通过在文件的末尾书写内容来保存文件的内容)
  • "x" (Write only. Creates a new file. Returns FALSE and an error if file already exists)
    “x”(只写格式。创建一个新的文件)
  • "x+" (Read/Write. Creates a new file. Returns FALSE and an error if file already exists)
    “x+”(可读/可写。创建一个新的文件。如果文件已经存在,则返回False或产生一个错误)
include_pathOptional. Set this parameter to '1' if you want to search for the file in the include_path (in php.ini) as well
可选参数。如果你想在include_path(位于php.ini文件中)搜索,将这个参数设置为“1”
contextOptional. Specifies the context of the file handle. Context is a set of options that can modify the behavior of a stream
可选参数。指定需要处理的文件内容[context]。Context是一组选项,它是用来修改文本流特征的。

原创粉丝点击