• <sub id="h4knl"><ol id="h4knl"></ol></sub>
    <sup id="h4knl"></sup>
      <sub id="h4knl"></sub>

      <sub id="h4knl"><ol id="h4knl"><em id="h4knl"></em></ol></sub><s id="h4knl"></s>
      1. <strong id="h4knl"></strong>

      2. PHP中的流介紹

        時(shí)間:2024-07-31 08:57:07 PHP 我要投稿
        • 相關(guān)推薦

        關(guān)于PHP中的流介紹

          PHP是一種 HTML 內(nèi)嵌式的語言,是一種在服務(wù)器端執(zhí)行的嵌入HTML文檔的腳本語言,語言的風(fēng)格有類似于C語言,被廣泛地運(yùn)用。

          概述

          流(streams)是PHP4.3版本引入的一個(gè)特性,主要是為了統(tǒng)一文件、sockets以及其他類似資源的工作方法。PHP4.3距今已經(jīng)有很長(zhǎng)時(shí)間了,但是很多程序員似乎都不能正確使用PHP中的流,當(dāng)然這也包括我。以前也在一些程序中遇到過流的使用,如php://input,但是一直沒機(jī)會(huì)整理,今天就把這部分知識(shí)整理下。

          流是由PHP提供的資源,可以供我們透明的使用,而且流是一個(gè)非常強(qiáng)大的工具。適當(dāng)?shù)脑诔绦蛑惺褂昧鳎梢詫⑽覀兊某绦驇У揭粋€(gè)新的高度。

          PHP手冊(cè)中對(duì)流的描述如下:

          復(fù)制代碼 代碼如下:

          Streams were introduced with PHP 4.3.0 as a way of generalizing file, network, data compression, and other operations which share a common set of functions and uses. In its simplest definition, a stream is a resource object which exhibits streamable behavior. That is, it can be read from or written to in a linear fashion, and may be able to fseek() to an arbitrary locations within the stream.

          每一種流都實(shí)現(xiàn)了一個(gè)包裝器(wrapper),包裝器包含一些額外的代碼用來處理特殊的協(xié)議和編碼。PHP提供了一些內(nèi)置的包裝器,我們也可以很輕松的創(chuàng)建和注冊(cè)自定義的包裝器。我們甚至可以使用上下文(contexts)和過濾器來改變和增強(qiáng)包裝器。

          流基礎(chǔ)知識(shí)

          PHP中流的形式如:://。是包裝器的名字,的內(nèi)容取決于不同的包裝器語法。

          默認(rèn)的包裝器是file://,也就是說每次我們?cè)L問文件系統(tǒng)的時(shí)候都使用了流。例如,我們可以使用如下兩種方式來讀取文件:readfile(/path/to/somefile.txt)和readfile(file:///path/to/somefile.txt),使用這兩種方式讀取文件,可以得到相同的結(jié)果。

          正如前面所說,PHP提供了一些內(nèi)置的包裝器、協(xié)議和過濾器。查看我們的機(jī)器上安裝了哪些包裝器,可以使用如下幾個(gè)函數(shù):

          復(fù)制代碼 代碼如下:

          var_dump(stream_get_transports());

          var_dump(stream_get_wrappers());

          var_dump(stream_get_filters());

          >

          我本地的環(huán)境輸出內(nèi)容如下:

          復(fù)制代碼 代碼如下:

          array (size=8)

          0 => string tcp (length=3)

          1 => string udp (length=3)

          2 => string unix (length=4)

          3 => string udg (length=3)

          4 => string ssl (length=3)

          5 => string sslv3 (length=5)

          6 => string sslv2 (length=5)

          7 => string tls (length=3)

          array (size=12)

          0 => string https (length=5)

          1 => string ftps (length=4)

          2 => string compress.zlib (length=13)

          3 => string compress.bzip2 (length=14)

          4 => string php (length=3)

          5 => string file (length=4)

          6 => string glob (length=4)

          7 => string data (length=4)

          8 => string http (length=4)

          9 => string ftp (length=3)

          10 => string phar (length=4)

          11 => string zip (length=3)

          array (size=12)

        《&.doc》
        将本文的Word文档下载到电脑,方便收藏和打印
        推荐度:
        点击下载文档

        【PHP中的流介紹】相關(guān)文章:

        簡(jiǎn)單分析PHP中序列化用法介紹08-15

        PHP中curl的使用實(shí)例07-31

        PHP中關(guān)于類的定義10-02

        PHP中函數(shù)的使用說明09-01

        PHP中的排序函數(shù)區(qū)別分析08-23

        簡(jiǎn)單介紹php構(gòu)造函數(shù)用法08-31

        php中dirname()和--FILE--常量的用法09-26

        PHP中date函數(shù)常用時(shí)間處理方法09-13

        PHP中MySQL、MySQLi和PDO的用法和區(qū)別07-01

        php中static靜態(tài)變量的使用方法06-11

        在线咨询
        国产高潮无套免费视频_久久九九兔免费精品6_99精品热6080YY久久_国产91久久久久久无码
      3. <sub id="h4knl"><ol id="h4knl"></ol></sub>
        <sup id="h4knl"></sup>
          <sub id="h4knl"></sub>

          <sub id="h4knl"><ol id="h4knl"><em id="h4knl"></em></ol></sub><s id="h4knl"></s>
          1. <strong id="h4knl"></strong>

          2. 亚洲少妇AⅤ在线电 | 一级中文在线播放 | 伊人久久大香线蕉成人综合网 | 亚洲最大色资源在线观看 | 亚洲AV综合色区久久精品 | 熟女制服丝袜另类中文字幕 |

            關(guān)于PHP中的流介紹

              PHP是一種 HTML 內(nèi)嵌式的語言,是一種在服務(wù)器端執(zhí)行的嵌入HTML文檔的腳本語言,語言的風(fēng)格有類似于C語言,被廣泛地運(yùn)用。

              概述

              流(streams)是PHP4.3版本引入的一個(gè)特性,主要是為了統(tǒng)一文件、sockets以及其他類似資源的工作方法。PHP4.3距今已經(jīng)有很長(zhǎng)時(shí)間了,但是很多程序員似乎都不能正確使用PHP中的流,當(dāng)然這也包括我。以前也在一些程序中遇到過流的使用,如php://input,但是一直沒機(jī)會(huì)整理,今天就把這部分知識(shí)整理下。

              流是由PHP提供的資源,可以供我們透明的使用,而且流是一個(gè)非常強(qiáng)大的工具。適當(dāng)?shù)脑诔绦蛑惺褂昧鳎梢詫⑽覀兊某绦驇У揭粋€(gè)新的高度。

              PHP手冊(cè)中對(duì)流的描述如下:

              復(fù)制代碼 代碼如下:

              Streams were introduced with PHP 4.3.0 as a way of generalizing file, network, data compression, and other operations which share a common set of functions and uses. In its simplest definition, a stream is a resource object which exhibits streamable behavior. That is, it can be read from or written to in a linear fashion, and may be able to fseek() to an arbitrary locations within the stream.

              每一種流都實(shí)現(xiàn)了一個(gè)包裝器(wrapper),包裝器包含一些額外的代碼用來處理特殊的協(xié)議和編碼。PHP提供了一些內(nèi)置的包裝器,我們也可以很輕松的創(chuàng)建和注冊(cè)自定義的包裝器。我們甚至可以使用上下文(contexts)和過濾器來改變和增強(qiáng)包裝器。

              流基礎(chǔ)知識(shí)

              PHP中流的形式如:://。是包裝器的名字,的內(nèi)容取決于不同的包裝器語法。

              默認(rèn)的包裝器是file://,也就是說每次我們?cè)L問文件系統(tǒng)的時(shí)候都使用了流。例如,我們可以使用如下兩種方式來讀取文件:readfile(/path/to/somefile.txt)和readfile(file:///path/to/somefile.txt),使用這兩種方式讀取文件,可以得到相同的結(jié)果。

              正如前面所說,PHP提供了一些內(nèi)置的包裝器、協(xié)議和過濾器。查看我們的機(jī)器上安裝了哪些包裝器,可以使用如下幾個(gè)函數(shù):

              復(fù)制代碼 代碼如下:

              var_dump(stream_get_transports());

              var_dump(stream_get_wrappers());

              var_dump(stream_get_filters());

              >

              我本地的環(huán)境輸出內(nèi)容如下:

              復(fù)制代碼 代碼如下:

              array (size=8)

              0 => string tcp (length=3)

              1 => string udp (length=3)

              2 => string unix (length=4)

              3 => string udg (length=3)

              4 => string ssl (length=3)

              5 => string sslv3 (length=5)

              6 => string sslv2 (length=5)

              7 => string tls (length=3)

              array (size=12)

              0 => string https (length=5)

              1 => string ftps (length=4)

              2 => string compress.zlib (length=13)

              3 => string compress.bzip2 (length=14)

              4 => string php (length=3)

              5 => string file (length=4)

              6 => string glob (length=4)

              7 => string data (length=4)

              8 => string http (length=4)

              9 => string ftp (length=3)

              10 => string phar (length=4)

              11 => string zip (length=3)

              array (size=12)