fgetss -函数用法_PHP教程

PHP中文网
Release: 2016-07-20 11:01:06
Original
1225 people have browsed it

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。


$str = <<

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


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!