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

  • 相关阅读:
    explicit for ctors taking more than one argument
    Python 的 encode 和 decode
    Tripwire配置和运行
    man twadmin
    Tripwire策略说明
    Tripwire安装
    [部分翻译] tripwire(8)
    snort-2.9.3.1安装
    [转载] snort中文手册
    wireshark_1.2.11安装
  • 原文地址:https://www.cnblogs.com/mingzhanghui/p/9351424.html
Copyright © 2011-2022 走看看