php stream 流封装协议
2024-09-08 14:45:04
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
最新文章
- ABP文档 - 后台作业和工作者
- extJs学习基础5 理解mvvm的一个小案例
- Javascript事件冒泡机制
- 关于https的Error:Error Domain=NSURLErrorDomain Code=-1012
- 【转】MySQL中增加sequence管理功能(模拟创建sequence)
- hihoCoder太阁最新面经算法竞赛17
- iOS程序进入后台后仍运行定时器NSTimer
- git删除远程分支和本地分支
- Jquery 弹出新窗体
- iOS改变图片尺寸
- 1005 Jugs
- error U1087: cannot have : and :: dependents for same target
- Web静态和动态项目委托代理基于面向方面编程AOP
- 【.net 深呼吸】自定义应用程序配置节
- Android简易实战教程--第四十八话《Android - Timer、TimerTask和Handler实现倒计时》
- 关于thinkphp5手动抛出Http异常时自定义404页面报错的问题
- spring+springmvc+hibernate 框架搭建
- C# 显式转换关键字 explicit
- Activiti 用户手册
- Oracle中PL/SQL的循环语句