php://input-它在fopen()中有什么作用? [英] php://input - what does it do in fopen()?
问题描述
$handle = fopen("/home/rasmus/file.txt", "r");
$handle = fopen("/home/rasmus/file.gif", "wb");
我可以理解/home/rasmus/file.txt
和/home/rasmus/file.gif
是文件路径.
I can understand this that /home/rasmus/file.txt
and /home/rasmus/file.gif
are the file path.
但是这些是什么意思:
php://input
php://temp
在
$objInputStream = fopen("php://input", "r");
$objTempStream = fopen("php://temp", "w+b");
他们做什么?
推荐答案
php://input
是只读流,允许您从请求正文中读取原始数据.对于POST请求,最好使用$HTTP_RAW_POST_DATA
,因为它不依赖于特殊的php.ini指令.此外,对于默认情况下未填充$HTTP_RAW_POST_DATA
的那些情况,它是激活always_populate_raw_post_data
的一种潜在的内存密集型替代方法. php://input在enctype="multipart/form-data"
中不可用.
php://input
is a read-only stream that allows you to read raw data from the request body. In the case of POST requests, it is preferable to$HTTP_RAW_POST_DATA
as it does not depend on special php.ini directives. Moreover, for those cases where$HTTP_RAW_POST_DATA
is not populated by default, it is a potentially less memory intensive alternative to activatingalways_populate_raw_post_data
. php://input is not available withenctype="multipart/form-data"
.
查看手册: http://php.net/manual/zh/wrappers .php.php
这篇关于php://input-它在fopen()中有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!