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...