Stream Basics Stream can be referenced by <scheme>://<target>. Where <scheme> is the name of the wrapper class,<target> content is specified by the syntax of the wrapper class, the syntax of the different wrapper classes will vary. The default wrapper class for PHP is file://, which means that when we access the file system, we are actually using a stream. We can read the contents of the file in the following two ways, ReadFile ('/path/to/somefile.txt ') or ReadFile (' File:///path/to/somefile.txt '), both of which are equivalent. If you are using ReadFile (' http://google.com/'), then PHP will choose the HTTP stream wrapper class to operate. As mentioned above, PHP provides a number of built-in package-to-class, protocol, and filter. You can query the wrapper classes supported by this machine as described below: ?
1234 |
<?php print_r(stream_get_transports()); print_r(stream_get_wrappers()); print_r(stream_get_filters()); |
The output on my machine is: ?
1234567891011121314151617181920212223242526272829303132333435363738394041 |
Array
(
[0] => tcp
[1] => udp
[2] => unix
[3] => udg
[4] => ssl
[5] => sslv3
[6] => sslv2
[7] => tls
)
Array
(
[0] => https
[1] => ftps
[2] => compress.zlib
[3] => compress.bzip2
[4] => php
[5] => file
[6] =>
glob
[7] => data
[8] => http
[9] => ftp
[10] => zip
[11] => phar
)
Array
(
[0] => zlib.*
[1] => bzip2.*
[2] => convert.iconv.*
[3] => string.rot13
[4] => string.toupper
[5] => string.tolower
[6] => string.
strip_tags
[7] => convert.*
[8] => consumed
[9] => dechunk
[10] => mcrypt.*
[11] => mdecrypt.*
)
|
There are a lot of features that look good, right? In addition to the above built-in stream, we can also write more third-party streams for Amazon S3, MS Excel, Google Storage, Dropbox and even Twitter. |
Yihunter Translated 2 days ago0 Person Top Top translation of good Oh! |