fgetss -函數用法_PHP教程

來源:互聯網
上載者:User
fgetss

(PHP 4, PHP 5, PHP 7)

fgetss — 從檔案指標中讀取一行並過濾掉 HTML 標籤
說明
string fgetss ( resource $handle [, int $length [, string $allowable_tags ]] )

和 fgets() 相同,只除了 fgetss() 嘗試從讀取的文本中去掉任何 HTML 和 PHP 標記。
參數

handle

檔案指標必須是有效,必須指向由 fopen() 或 fsockopen() 成功開啟的檔案(並還未由 fclose() 關閉)。
length

取回該長度的資料。
allowable_tags

可以用可選的第三個參數指定哪些標記不被去掉。

傳回值

從 handle 指向的檔案中大讀取 length - 1 個位元組的字元,並過濾了所有的 HTML 和 PHP 代碼。

錯誤發生時返回 FALSE。


<?php

$str = <<<eod

Welcome! Today is the of .



Text outside of the HTML block.
EOD;
file_put_contents('sample.php', $str);

$handle = @fopen("sample.php", "r");
if ($handle) {
while (!feof($handle)) {
$buffer = fgetss($handle, 4096);
echo $buffer;
}
fclose($handle);
}
?>



http://www.bkjia.com/PHPjc/445478.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/445478.htmlTechArticlefgetss -»ñÈ¡Ïß´ÓÎļþÖ¸ÕëºÍ´ø±ê¼Ç fgetss £¨ PHP 4ÖУ¬ PHP 5ÖУ fgetss -»ñÈ¡Ïß´ÓÎļþÖ¸ÕëºÍ´ø±ê¼Ç ÃèÊö ×Ö·û´fgetss...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.