Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand the return value of php stream_get_meta_data

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "how to understand the php stream_get_meta_data return value". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to understand the php stream_get_meta_data return value".

The copy code is as follows:

The output on my local machine is as follows:

Array

(

[wrapper_data] = > Array

(

[0] = > HTTP/1.0 200 OK

[1] = > Date: Tue, 06 Dec 2011 10:08:11 GMT

[2] = > Server: Apache

[3] = > Last-Modified: Tue, 06 Dec 2011 10:07:12 GMT

[4] = > Accept-Ranges: bytes

[5] = > X-Powered-By: mod_xlayout/rc2

[6] = > Cache-Control: max-age=60

[7] = > Expires: Tue, 06 Dec 2011 10:09:11 GMT

[8] = > Vary: Accept-Encoding

[9] = > X-UA-Compatible: IE=EmulateIE7

[10] = > Content-Type: text/html

[11] = > Age: 26

[12] = > Content-Length: 675274

[13] = > X-Cache: HIT from xd33-98.HP08040037.sina.com.cn

[14] = > Connection: close

)

[wrapper_type] = > http

[stream_type] = > tcp_socket/ssl

[mode] = > r

[unread_bytes] = > 3759

[seekable] = >

[uri] = > http://www.sina.com.cn

[timed_out] = >

[blocked] = > 1

[eof] = >

)

Description

Array stream_get_meta_data (int $fp)

Returns information about an existing stream. It can be any stream established by fopen (), fsockopen (), and pfsockopen (). The returned array contains the following items:

Timed_out (bool)-TRUE if the stream timed out waiting for data in the last call to fread () or fgets ().

Blocked (bool)-TRUE if the stream is in blocking IO mode. See stream_set_blocking ().

Eof (bool)-TRUE if the stream reaches the end of the file. Note that it can be TRUE for socket streams even when unread_bytes is non-zero. To determine if there is more data to read, use feof () instead of reading the value of this item.

Unread_bytes (int)-the number of bytes currently in PHP's own internal buffer.

Note: do not use this value in scripts.

The following items are new to PHP 4.3:

Stream_type (string)-an annotation that describes the underlying implementation of the flow.

Wrapper_type (string)-an annotation that describes the hierarchical protocol encapsulation implementation of a flow. For more information about encapsulation protocols, see supported protocols and encapsulation protocols.

Wrapper_data (mixed)-the encapsulation protocol data attached to the current stream. For more information about encapsulation protocols and their data, see supported protocols and encapsulation protocols.

Filters (array)-an array containing any filter names superimposed on the current stream. The documentation for filters is shown in the list of available filters in the appendix.

Note:

This function was introduced by PHP 4.3. prior to this version, you can use socket_get_status () to get the first four items and can only be used for socket-based streams.

In PHP 4.3 and later, socket_get_status () is an alias for this function.

Note: this function does not work on streams created through the Socket extension library.

The following items are new to PHP 5.0:

Mode (string)-the type of access required for the current stream (see Table 1 in fopen ()).

Seekable (bool)-whether it can be located in the current stream.

Uri (string)-the URI or file name associated with the current stream.

Thank you for your reading, the above is the content of "how to understand the php stream_get_meta_data return value". After the study of this article, I believe you have a deeper understanding of how to understand the php stream_get_meta_data return value, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report