uTools-Manuals/docs/php/parse_ini_string.html
2019-04-28 19:00:34 +08:00

116 lines
4.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>解析配置字符串</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.parse-ini-string" class="refentry">
<div class="refnamediv">
<h1 class="refname">parse_ini_string</h1>
<p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7)</p><p class="refpurpose"><span class="refname">parse_ini_string</span> &mdash; <span class="dc-title">解析配置字符串</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.parse-ini-string-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>parse_ini_string</strong></span>
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$ini</code></span>
[, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$process_sections</code><span class="initializer"> = false</span></span>
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$scanner_mode</code><span class="initializer"> = INI_SCANNER_NORMAL</span></span>
]] ) : <span class="type">array</span></div>
<p class="para rdfs-comment">
<span class="function"><strong>parse_ini_string()</strong></span> 返回 <code class="parameter">ini</code> 字符串解析后的关联数组
</p>
<p class="para">
ini 字符串的格式参考 <var class="filename">php.ini</var>
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.parse-ini-string-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">ini</code></dt>
<dd>
<p class="para">
ini 字符串内容
</p>
</dd>
<dt>
<code class="parameter">process_sections</code></dt>
<dd>
<p class="para">
设置 <code class="parameter">process_sections</code> 参数为 <strong><code>TRUE</code></strong>,得到一个多维数组,包含名称和设置。<code class="parameter">process_sections</code> 默认为 <strong><code>FALSE</code></strong>
</p>
</dd>
<dt>
<code class="parameter">scanner_mode</code></dt>
<dd>
<p class="para">
可以是 <strong><code>INI_SCANNER_NORMAL</code></strong> (默认)或 <strong><code>INI_SCANNER_RAW</code></strong> 。如果是 <strong><code>INI_SCANNER_RAW</code></strong>,那么选项值不会被解析。
</p>
<p class="para">
As of PHP 5.6.1 can also be specified as <strong><code>INI_SCANNER_TYPED</code></strong>.
In this mode boolean, null and integer types are preserved when possible.
String values <em>&quot;true&quot;</em>, <em>&quot;on&quot;</em> and <em>&quot;yes&quot;</em>
are converted to <strong><code>TRUE</code></strong>. <em>&quot;false&quot;</em>, <em>&quot;off&quot;</em>, <em>&quot;no&quot;</em>
and <em>&quot;none&quot;</em> are considered <strong><code>FALSE</code></strong>. <em>&quot;null&quot;</em> is converted to <strong><code>NULL</code></strong>
in typed mode. Also, all numeric strings are converted to integer type if it is possible.
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.parse-ini-string-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
执行成功返回一个关联数组,返回 <strong><code>FALSE</code></strong> 为失败
</p>
</div>
<div class="refsect1 notes" id="refsect1-function.parse-ini-string-notes">
<h3 class="title">注释</h3>
<blockquote class="note"><p><strong class="note">Note</strong>:
<span class="simpara">
保留关键字不能作为 ini 的键,包括 null, yes, no, true, false, on, off, none以及空值offno 和错误的结果集,值为 yes 和 正确的结果集。除非使用 <strong><code>INI_SCANNER_TYPED</code></strong> 模式。 字符 <em>?{}|&amp;~![()^&quot;</em> 不能在任何地方使用作为键和有特殊意义的值。
</span>
</p></blockquote>
</div>
<div class="refsect1 seealso" id="refsect1-function.parse-ini-string-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="parse_ini_file.html" class="function" rel="rdfs-seeAlso">parse_ini_file()</a> - 解析一个配置文件</span></li>
</ul>
</p>
</div>
</div></div></div></body></html>