Home >Backend Development >PHP Tutorial >fgetss - Function Usage_PHP Tutorial
fgetss
(PHP 4, PHP 5, PHP 7)
fgetss — Read a line from the file pointer and filter out HTML tags
Description
string fgetss ( resource $handle [, int $length [, string $allowable_tags ]] )
Same as fgets(), except that fgetss() attempts to strip any HTML and PHP tags from the read text.
Parameters
handle
The file pointer must be valid and must point to a file successfully opened by fopen() or fsockopen() (and has not been closed by fclose()).
length
Retrieve the data of this length.
allowable_tags
You can use the optional third parameter to specify which tags are not to be removed.
Return Value
Read length - 1 byte characters from the file pointed to by handle, filtering out all HTML and PHP code.
Returns FALSE when an error occurs.
$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); ?>
http://www.bkjia.com/PHPjc/445478.htmlwww.bkjia.comtruehttp://www .bkjia.com/PHPjc/445478.htmlTechArticlefgetss -»ñÈ¡ Ïß´ÓÎļָÕëºÍ´ø±ê¼Ç fgetss £¨ PHP 4ÖУ¬ PHP 5ÖУ© fgetss -»ñС Ïß´ÓÎļָÕëºÍ´ø±ê¼Ç ÃèÊö ×Ö·û´®fgetss...