(PHP 4, PHP 5, PHP 7)
fgetss — 锟斤拷锟侥硷拷指锟斤拷锟叫讹拷取一锟叫诧拷锟斤拷锟剿碉拷 HTML 锟斤拷锟�
$handle
[, int $length
[, string $allowable_tags
]] ) : string锟斤拷 fgets() 锟斤拷同锟斤拷只锟斤拷锟斤拷 fgetss() 锟斤拷锟皆从讹拷取锟斤拷锟侥憋拷锟斤拷去锟斤拷锟轿猴拷 HTML 锟斤拷 PHP 锟斤拷恰锟�
handle
锟侥硷拷指锟斤拷锟斤拷锟斤拷锟斤拷锟叫э拷模锟斤拷锟斤拷锟街革拷锟斤拷锟� fopen() 锟斤拷 fsockopen() 锟缴癸拷锟津开碉拷锟侥硷拷(锟斤拷锟斤拷未锟斤拷 fclose() 锟截憋拷)锟斤拷
length
取锟截该筹拷锟饺碉拷锟斤拷锟捷★拷
allowable_tags
锟斤拷锟斤拷锟矫匡拷选锟侥碉拷锟斤拷锟斤拷锟斤拷锟斤拷指锟斤拷锟斤拷些锟斤拷遣锟斤拷锟饺ワ拷锟斤拷锟�
锟斤拷 handle
指锟斤拷锟斤拷募锟斤拷写锟斤拷取 length
- 1 锟斤拷锟街节碉拷锟街凤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟叫碉拷 HTML 锟斤拷 PHP 锟斤拷锟诫。
锟斤拷锟斤拷锟斤拷时锟斤拷锟斤拷 FALSE
锟斤拷
锟芥本 | 说锟斤拷 |
---|---|
5.0.0 |
锟斤拷锟斤拷 length 锟斤拷 锟剿匡拷始锟斤拷选锟斤拷
|
Example #1 一锟斤拷锟叫讹拷取一锟斤拷 PHP 锟侥硷拷
<?php
$str = <<<EOD
<html><body>
<p>Welcome! Today is the <?php echo(date('jS')); ?> of <?= date('F'); ?>.</p>
</body></html>
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);
echo $buffer;
}
fclose($handle);
}
?>
锟斤拷锟斤拷锟斤拷锟教碉拷锟斤拷锟斤拷锟斤拷锟斤拷冢锟�
Welcome! Today is the of . Text outside of the HTML block.
Note: 锟节讹拷取锟斤拷 Macintosh 锟斤拷锟斤拷锟叫伙拷锟斤拷锟戒创锟斤拷锟斤拷锟侥硷拷时锟斤拷 锟斤拷锟� PHP 锟斤拷锟斤拷锟斤拷确锟斤拷识锟斤拷锟叫斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷时锟斤拷锟矫匡拷选锟斤拷 auto_detect_line_endings 也锟斤拷锟斤拷越锟斤拷锟斤拷锟斤拷锟解。