PHP input/output stream

Source: Internet
Author: User
Tags readfile
PHP 3.0.13 And later versions, from PHP 4.3.0 Startup support PHP: // output And PHP: // Input , From PHP 5.0.0 Startup support PHP: // Filter .
    • PHP: // stdin

    • PHP: // stdout

    • PHP: // stderr

    • PHP: // output

    • PHP: // Input

    • PHP: // Filter

PHP: // stdin,PHP: // stdoutAndPHP: // stderrAllow access to the input or output stream of the PHP process.

PHP: // outputAllows writing data to the output buffer, andPrint ()AndEcho ().

PHP: // InputAllows you to read original post data. And$ Http_raw_post_dataCompared to memory, it puts less pressure on memory and does not require any specialPHP. ini.

PHP: // stdinAndPHP: // InputIs read-only, at the same time,PHP: // stdout,PHP: // stderrAndPHP: // outputWrite-only.

PHP: // FilterIs designed to allow FiltersProgramIt is a stream Encapsulation Protocol when it is opened. This is for file functions that have individual complete functions, suchReadfile (),File ()AndFile_get_contents ()It is useful, otherwise it will not be able to apply the filter to the stream before reading the content.

PHP: // FilterThe target accepts the subsequent 'parameters' as part of its 'path.

  • /Resource = <stream to be filtered>(Required) This parameter must be locatedPHP: // FilterAnd point to the stream to be filtered.

    <? PHP
    /* This is equivalent to simply:
    Readfile ("http://www.example.com ");
    Since no filters are actually specified */
    Readfile ("PHP: // filter/resource = http://www.example.com ");
    ?>

  • /Read = <Filter list to apply to read chain>(Optional) This parameter accepts the names of one or more filters, using pipeline characters.|Separated.

    <? PHP
    /* This will output the contents
    Www.example.com entirely in uppercase */
    Readfile ("PHP: // filter/read = string. toupper/resource = http://www.example.com ");
    /* This will do the same as abve
    But will also rot13 encode it */
    Readfile ("PHP: // filter/read = string. toupper | string. rot13/resource = http://www.example.com ");
    ?>

  • /Write = <Filter list to apply to write chain>(Optional) This parameter accepts the names of one or more filters, using pipeline characters.|Separated.

    <? PHP
    /* This will filter the string "Hello World"
    Through the rot13 filter, then write
    Example.txt in the current directory */
    File_set_contents ("PHP: // filter/Write = string. rot13/resource=example.txt", "Hello World ");
    ?>

  • /<Filter list to apply to both chains>(Optional) AnyRead =OrWrite =The specified filter is applied to the read/write chain at the same time.

Table I-5. Wrapper Summary (PHP: // Filter, Refer to summary of wrapper being filtered .)

Attribute
Supported

RestrictedAllow_url_fopen.
No

Allows reading
PHP: // stdinAndPHP: // InputOnly.

Allows writing
PHP: // stdout,PHP: // stderr, AndPHP: // outputOnly.

Allows appending
PHP: // stdout,PHP: // stderr, AndPHP: // outputOnly. (equivalent to writing)

Allows simultaneous reading and writing
No. These wrappers are unidirectional.

SupportsStat ()
No

SupportsUnlink ()
No

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.