Home >Backend Development >PHP Tutorial > rewind指针定位有关问题

rewind指针定位有关问题

WBOY
WBOYOriginal
2016-06-13 13:48:301088browse

rewind指针定位问题!
好像rewind定位指针报错 什么问题?
代码如下:
 $fpstr = fopen("php://input", "rb");
...略
$bin = fread($fpstr, 2); //只读2字节
...略
fseek($fpstr,0); //这里报错

//这里需要再次使用$fpstr资源
$realSize = stream_copy_to_stream($fpstr, $tmp); //此时新建的文件少了两个字节  

怎么定位指针到$fpstr开头处啊 使文件完整.

------解决方案--------------------
$fpstr = fopen("php://input", "rb");

php://input 是输入流
你不可能对 流 做定位操作

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn