http://php.net/manual/wrappers.php
过程:
1. 开始通信
2. 读取数据
3. 写入数据
4. 结束通信
usage:
* 读写文件系统
<?php
$handle = fopen('file:///etc/hosts', 'rb');
while (feof($handle) !== true) {
echo fgets($handle);
}
fclose($handle);
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 bogon # added by Apache Friends XAMPP
192.168.10.10 homestead.test
192.168.10.10 homestead.app
192.168.10.127 mingzhanghui
/etc/hosts
* 通过HTTP、HTTPS、ssh与远程web服务器通信
<?php
$json = file_get_contents(
'https://www.hao123.com/api/tnwhilte?tn=93082360_s_hao_pg'
); $a = json_decode($json, true);
var_dump($a);
array(4) {
["errno"]=> int(0)
["ft"] => string(75) "UWYknj0krj6sn7qCmyqxTAThIjYkPHnznWm1rjTzP1DYFhnqpA7EnHc1Fh7W5HD4n1m4nj63Pjb"
["fake"]=> int(1)
["tn"] => string(15) "10018800_hao_pg"
}
* 打开并读写zip、rar、phar压缩文件
PHP博客链接
http://www.cnblogs.com/52fhy/category/604746.html