PHP fgetss () function
Definition and Usage
fgetss () function returns a line from an open file, and filter out HTML and PHP tags.
fgetss () function when it reaches the end of a specified length or read file (EOF) (whichever comes first), Stop to return to a new line.
If it fails the function returns FALSE.
grammar
fgetss(file,length,tags)
参数 | 描述 |
---|---|
file | 必需。规定要检查的文件。 |
length | 可选。规定要读取的字节数。默认是 1024 字节。 注意:该参数在 PHP 5 之前的版本是必需的。 |
tags | 可选。指定将被删除的标签。 |
Example 1
<?php
$file = fopen("test.htm","r");
echo fgetss($file);
fclose($file);
?>
$file = fopen("test.htm","r");
echo fgetss($file);
fclose($file);
?>
The code above will output:
This is a paragraph.
Example 2
<?php
$file = fopen("test.htm","r");
echo fgetss($file,1024,"<p>,<b>");
fclose($file);
?>
$file = fopen("test.htm","r");
echo fgetss($file,1024,"<p>,<b>");
fclose($file);
?>
The code above will output:
This is a paragraph.
The above source code is output:
<p><b>This is a paragraph.</b></p>
Complete PHP Filesystem Reference Manual