fgetss
Read a line from a file pointer and filter out HTML tags
fgetss()
function reads a line from the open file and filters out HTML and PHP tags.
The same as fgets()
, the difference is that fgetss tries to remove any HTML and PHP tags from the read text.
<?php $file = fopen ( "test.htm" , "r" ) ; echo fgetss ( $file ) ; fclose ( $file ) ; ?>
The output is similar:
This is a paragraph.
<?php $file = fopen ( "test.htm" , "r" ) ; echo fgetss ( $file , 1024 , "<p>,<b>" ) ; fclose ( $file ) ; ?>
The output is similar:
This is a paragraph.
The output source code is:
< p > < b > This is a paragraph . < / b > < / p >
fgetss ( file , length , tags )
parameter | describe |
---|---|
file | Required. Specifies the file to be read. |
length | Optional. Specifies the number of bytes to be read. The default is 1024 bytes. This parameter is required before PHP 5. |
tags | Optional. Tags that are not deleted. |
The optional third parameter tags can be used to specify which tags are not removed.
If it fails, return false.