downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

SplFileObject::flock> <SplFileObject::fgets
[edit] Last updated: Fri, 25 May 2012

view this page in

SplFileObject::fgetss

(PHP 5 >= 5.1.0)

SplFileObject::fgetssファイルから 1 行取り出し HTML タグを取り除く

説明

public string SplFileObject::fgetss ([ string $allowable_tags ] )

SplFileObject::fgetss() attempts to strip 読み込むテキストから HTML と PHP タグを取り除こうとすること以外、 SplFileObject::fgets() と同じです。

パラメータ

allowable_tags

オプションとして 3 番目のパラメータを使用して、取り除きたくないタグを指定することができます。

返り値

HTML と PHP コードが取り除かれたファイルの次の行を含む文字列、もしくは FALSE を返します。

例1 SplFileObject::fgetss() の例

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

$file = new SplFileObject("sample.php");
while (!
$file->eof()) {
    echo 
$file->fgetss();
}
?>

上の例の出力は、 たとえば以下のようになります。


 Welcome! Today is the  of .

Text outside of the HTML block.

参考



add a note add a note User Contributed Notes SplFileObject::fgetss
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites