PHP built-in encapsulation protocol: // filter

Source: Internet
Author: User
Tags php website
PHP: filter php: // filter is an encapsulation protocol designed to allow a filter program to flow when it is opened. This is useful for file functions with complete functions such as readfile (), file (), and file_get_contents (). Otherwise, you will not be able to apply the filter to the stream before reading the content.

The protocol syntax is

Php: // filter:/=

For example php: // filter:/resource = http://www.baidu.com

Use php: // filter to obtain webpage content

              

Php: // filter parameter list

Read

Write

Resource Data Source (required)

The read parameter value can be

String. strip_tags clears all html tags in the data stream
String. toupper converts the content in the data stream to uppercase
String. tolower converts the content in the data stream to lowercase

Convert. base64-encode converts contents in the data stream to base64 encoding

Convert. base64-decode corresponds to the above decoding

Example:

              

Using string. strip_tags to process data is comparable to the strip_tags function, because the data has been synchronized ..

The usage of other parameters is the same.

There are also many such filter encapsulation protocols. for details, refer to the official php website.

Http://docs.php.net/manual/zh/wrappers.php

You can also create a stream package.

How to use the stream_wapper_register function to go to the official website.

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.