zoukankan      html  css  js  c++  java
  • php stream 流封装协议

    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

  • 相关阅读:
    C# MVC解决跨站请求伪造(appscan)
    .net中关于Url传参问题
    二月项目完成小结
    sql 获取时间
    ajax提交form表单
    C# 视图遍历List数组
    C#遍历指定文件夹中的所有文件
    C#关于文件的操作
    .net 文件上传到服务器【转】
    Server.MapPath获取各级目录【转】
  • 原文地址:https://www.cnblogs.com/mingzhanghui/p/9351424.html
Copyright © 2011-2022 走看看