Current Location: Home> Function Categories> fgetss

fgetss

Read a line from a file pointer and filter out HTML tags
Name:fgetss
Category:File system
Programming Language:php
One-line Description:Read a line from the open file and filter out HTML and PHP tags.

Definition and usage

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.

Example

Example 1

 <?php

$file = fopen ( "test.htm" , "r" ) ;
echo fgetss ( $file ) ;
fclose ( $file ) ;

?>

The output is similar:

 This is a paragraph.

Example 2

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

grammar

 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.

illustrate

The optional third parameter tags can be used to specify which tags are not removed.

If it fails, return false.

Similar Functions
Popular Articles