php中的fopen函数

fopen("c:\\folder\\resource.txt""r");

'r'只读方式打开,将文件指针指向文件头。
'r+'读写方式打开,将文件指针指向文件头。
'w'写入方式打开,将文件指针指向文件头并将文件大小截为零。如果文件不存在则尝试创建之。
'w+'读写方式打开,将文件指针指向文件头并将文件大小截为零。如果文件不存在则尝试创建之。
'a'写入方式打开,将文件指针指向文件末尾。如果文件不存在则尝试创建之。
'a+'读写方式打开,将文件指针指向文件末尾。如果文件不存在则尝试创建之。
'x'创建并以写入方式打开,将文件指针指向文件头。如果文件已存在,则 fopen() 调用失败并返回FALSE,并生成一条 E_WARNING 级别的错误信息。如果文件不存在则尝试创建之。这和给 底层的open(2) 系统调用指定 O_EXCL|O_CREAT 标记是等价的。
'x+'创建并以读写方式打开,其他的行为和 'x' 一样。
'c'Open the file for writing only. If the file does not exist, it is created. If it exists, it is neither truncated (as opposed to 'w'), nor the call to this function fails (as is the case with 'x'). The file pointer is positioned on the beginning of the file. This may be useful if it's desired to get an advisory lock (seeflock()) before attempting to modify the file, as using 'w' could truncate the file before the lock was obtained (if truncation is desired, ftruncate() can be used after the lock is requested).
'c+'Open the file for reading and writing; otherwise it has the same behavior as 'c'

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值