mirror of
https://github.com/php/doc-ja.git
synced 2026-04-26 09:28:10 +02:00
158 lines
4.5 KiB
XML
158 lines
4.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: cb3e68d99d80a70feafc6f9a1b5f678e4d0522af Maintainer: hirokawa Status: ready -->
|
|
<!-- Credits: mumumu -->
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.fgetss">
|
|
<refnamediv>
|
|
<refname>fgetss</refname>
|
|
<refpurpose>ファイルポインタから 1 行取り出し、HTML タグを取り除く</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsynopsisdiv>
|
|
&warn.deprecated.function-7-3-0.removed-8-0-0;
|
|
</refsynopsisdiv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>fgetss</methodname>
|
|
<methodparam><type>resource</type><parameter>handle</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>length</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>allowable_tags</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>fgets</function> と同じですが、
|
|
<function>fgetss</function> は読み込んだテキストから
|
|
NUL バイト や HTML および PHP のタグを取り除こうとすることが異なります。
|
|
この関数は、ある呼び出しから別の呼び出しの間のパースの状態を保持します。
|
|
したがって、これは <function>fgets</function> の戻り値に対して
|
|
<function>strip_tags</function> 関数を呼び出すのと同じではありません。
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>handle</parameter></term>
|
|
<listitem>
|
|
&fs.validfp.all;
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>length</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
取得したいデータの長さ。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>allowable_tags</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
オプションの 3 番目の引数を使用して、
|
|
取り除く必要がないタグを指定することができます。
|
|
<parameter>allowable_tags</parameter> について詳しくは <function>strip_tags</function> を参照ください。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
<parameter>handle</parameter> で指定したファイルポインタから最大
|
|
<parameter>length</parameter> - 1 バイト読み出し、
|
|
HTML や PHP コードを取り除いた文字列を返します。
|
|
</para>
|
|
<para>
|
|
エラーが発生した場合は &false; を返します。
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>PHP ファイルの 1 行ごとの読み込み</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?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);
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
Welcome! Today is the of .
|
|
|
|
Text outside of the HTML block.
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
¬e.line-endings;
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>fgets</function></member>
|
|
<member><function>fopen</function></member>
|
|
<member><function>popen</function></member>
|
|
<member><function>fsockopen</function></member>
|
|
<member><function>strip_tags</function></member>
|
|
<member><methodname>SplFileObject::fgetss</methodname></member>
|
|
<member>The <link linkend="filters.string.strip_tags">string.strip_tags</link> filter</member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|