fgetss - Function Usage_PHP Tutorial

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

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


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