PHP Conference Japan 2024

stream_get_filters

(PHP 5, PHP 7, PHP 8)

stream_get_filters取得已註冊過濾器的清單

說明

stream_get_filters(): 陣列

取得執行中系統上已註冊過濾器的清單。

參數

此函式沒有參數。

回傳值

返回一個索引陣列,其中包含所有可用串流過濾器的名稱。

範例

範例 #1 使用 stream_get_filters()

<?php
$streamlist
= stream_get_filters();
print_r($streamlist);
?>

以上範例會輸出類似以下的內容

Array (
  [0] => string.rot13
  [1] => string.toupper
  [2] => string.tolower
  [3] => string.base64
  [4] => string.quoted-printable
)

另請參閱

新增註解

使用者貢獻的註解 1 則註解

Jasper Bekkers
19 年前
用於 convert 過濾器中的過濾器有 base64-encode、base64-decode、quoted-printable-encode 和 quoted-printable-decode。注意:這些不在字串過濾器中,如同目前手冊所述!

範例用法如下
<?php
$h
= fopen('gecodeerd.txt', 'r');
stream_filter_append($h, 'convert.base64-decode');
fpassthru($h);
fclose($h);
?>
或者
<?php
$filter
= 'convert.base64-decode';
$file = 'coded.txt';
$h = fopen('php://filter/read=' . $filter . '/resource=' . $file,'r');
fpassthru($h);
fclose($h);
?>
To Top