mirror of
https://github.com/php/doc-ja.git
synced 2026-03-27 00:22:08 +01:00
152 lines
4.2 KiB
XML
152 lines
4.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 60809ebcf7d0c261b2f00e093e4fab70326ffc7b Maintainer: masakielastic Status: ready -->
|
|
<!-- Credits: mumumu -->
|
|
<refentry xml:id="splfileobject.setcsvcontrol" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>SplFileObject::setCsvControl</refname>
|
|
<refpurpose>CSV の区切り文字、囲み文字、エスケープ文字をセットする</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<modifier>public</modifier> <type>void</type><methodname>SplFileObject::setCsvControl</methodname>
|
|
<methodparam choice="opt"><type>string</type><parameter>separator</parameter><initializer>","</initializer></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>enclosure</parameter><initializer>"\""</initializer></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>escape</parameter><initializer>"\\"</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
CSV フィールド処理用の区切り文字と囲み文字とエスケープ文字をセットします。
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>separator</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
フィールドの区切り文字 (シングルバイト文字 1 文字のみ)。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>enclosure</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
フィールドの囲み文字 (シングルバイト文字 1 文字のみ)。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>escape</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
フィールドのエスケープ文字 (シングルバイト文字 最大で1文字)。
|
|
空文字列(<literal>""</literal>)を指定すると、(RFC 4180 に準拠していない) 独自仕様のエスケープ機構が無効になります。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
&return.void;
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>7.4.0</entry>
|
|
<entry>
|
|
<parameter>escape</parameter> パラメータは空文字列を受け入れるようになりました。
|
|
この場合、(RFC 4180 に準拠していない) 独自仕様のエスケープ機構が無効になります。
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><methodname>SplFileObject::setCsvControl</methodname> の例</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$file = new SplFileObject("data.csv");
|
|
$file->setFlags(SplFileObject::READ_CSV);
|
|
$file->setCsvControl('|');
|
|
foreach ($file as $row) {
|
|
list ($fruit, $quantity) = $row;
|
|
// Do something with values
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
<para>data.csv の内容</para>
|
|
<programlisting role="txt">
|
|
<![CDATA[
|
|
<?php
|
|
apples|20
|
|
bananas|14
|
|
cherries|87
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><methodname>SplFileObject::getCsvControl</methodname></member>
|
|
<member><methodname>SplFileObject::fgetcsv</methodname></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
|
|
-->
|