php://input-它在fopen()中有什么作用? [英] php://input - what does it do in fopen()?

查看:91
本文介绍了php://input-它在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_DATAis not populated by default, it is a potentially less memory intensive alternative to activating always_populate_raw_post_data. php://input is not available with enctype="multipart/form-data".

查看手册: http://php.net/manual/zh/wrappers .php.php

这篇关于php://input-它在fopen()中有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆