<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/mbstring.setup.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'mbstring.configuration.php',
    1 => '运行时配置',
    2 => '运行时配置',
  ),
  'up' => 
  array (
    0 => 'mbstring.setup.php',
    1 => '安装/配置',
  ),
  'prev' => 
  array (
    0 => 'mbstring.installation.php',
    1 => '安装',
  ),
  'next' => 
  array (
    0 => 'mbstring.constants.php',
    1 => '预定义常量',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/mbstring/ini.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mbstring.configuration" class="section">
 <h2 class="title">运行时配置</h2>
 <p class="simpara">
这些函数的行为受 <var class="filename">php.ini</var> 中的设置影响。
</p>
 <p class="para">
  <table class="doctable table">
   <caption><strong>mbstring 配置选项</strong></caption>
   
    <thead>
     <tr>
      <th>名字</th>
      <th>默认</th>
      <th>可修改范围</th>
      <th>更新日志</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td><a href="mbstring.configuration.php#ini.mbstring.language" class="link">mbstring.language</a></td>
      <td>&quot;neutral&quot;</td>
      <td><strong><code><a href="info.constants.php#constant.ini-all">INI_ALL</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><a href="mbstring.configuration.php#ini.mbstring.detect-order" class="link">mbstring.detect_order</a></td>
      <td>NULL</td>
      <td><strong><code><a href="info.constants.php#constant.ini-all">INI_ALL</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><a href="mbstring.configuration.php#ini.mbstring.http-input" class="link">mbstring.http_input</a></td>
      <td>&quot;pass&quot;</td>
      <td><strong><code><a href="info.constants.php#constant.ini-all">INI_ALL</a></code></strong></td>
      <td>已弃用</td>
     </tr>

     <tr>
      <td><a href="mbstring.configuration.php#ini.mbstring.http-output" class="link">mbstring.http_output</a></td>
      <td>&quot;pass&quot;</td>
      <td><strong><code><a href="info.constants.php#constant.ini-all">INI_ALL</a></code></strong></td>
      <td>已弃用</td>
     </tr>

     <tr>
      <td><a href="mbstring.configuration.php#ini.mbstring.internal-encoding" class="link">mbstring.internal_encoding</a></td>
      <td>NULL</td>
      <td><strong><code><a href="info.constants.php#constant.ini-all">INI_ALL</a></code></strong></td>
      <td>已弃用</td>
     </tr>

     <tr>
      <td><a href="mbstring.configuration.php#ini.mbstring.substitute-character" class="link">mbstring.substitute_character</a></td>
      <td>NULL</td>
      <td><strong><code><a href="info.constants.php#constant.ini-all">INI_ALL</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><a href="mbstring.configuration.php#ini.mbstring.func-overload" class="link">mbstring.func_overload</a></td>
      <td>&quot;0&quot;</td>
      <td><strong><code><a href="info.constants.php#constant.ini-system">INI_SYSTEM</a></code></strong></td>
      <td>
       自 PHP 7.2.0 起弃用，PHP 8.0.0 起删除。
      </td>
     </tr>

     <tr>
      <td><a href="mbstring.configuration.php#ini.mbstring.encoding-translation" class="link">mbstring.encoding_translation</a></td>
      <td>&quot;0&quot;</td>
      <td><strong><code><a href="info.constants.php#constant.ini-perdir">INI_PERDIR</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><a href="mbstring.configuration.php#ini.mbstring.http-output-conv-mimetypes" class="link">mbstring.http_output_conv_mimetypes</a></td>
      <td>&quot;^(text/|application/xhtml\+xml)&quot;</td>
      <td><strong><code><a href="info.constants.php#constant.ini-all">INI_ALL</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><a href="mbstring.configuration.php#ini.mbstring.strict-detection" class="link">mbstring.strict_detection</a></td>
      <td>&quot;0&quot;</td>
      <td><strong><code><a href="info.constants.php#constant.ini-all">INI_ALL</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><a href="mbstring.configuration.php#ini.mbstring.regex-retry-limit" class="link">mbstring.regex_retry_limit</a></td>
      <td>&quot;1000000&quot;</td>
      <td><strong><code><a href="info.constants.php#constant.ini-all">INI_ALL</a></code></strong></td>
      <td>自 PHP 7.4.0 起可用。</td>
     </tr>

     <tr>
      <td><a href="mbstring.configuration.php#ini.mbstring.regex-stack-limit" class="link">mbstring.regex_stack_limit</a></td>
      <td>&quot;100000&quot;</td>
      <td><strong><code><a href="info.constants.php#constant.ini-all">INI_ALL</a></code></strong></td>
      <td>自 PHP 7.3.5 起可用。</td>
     </tr>

    </tbody>
   
  </table>

  有关 INI_* 样式的更多详情与定义，见 <a href="configuration.changes.modes.php" class="xref">配置可被设定范围</a>。
 </p>
 
 <p class="para">这是配置指令的简短说明。</p>
 
 <p class="para">
  <dl>
   
    <dt id="ini.mbstring.language">
     <code class="parameter">mbstring.language</code>
     <span class="type"><a href="language.types.string.php" class="type string">string</a></span>
    </dt>
    <dd>
     <p class="para">
      mbstring 使用了国家默认语言设置（NLS）。
      注意，该选项自动地定义了 <code class="literal">mbstring.internal_encoding</code> 和
      <code class="literal">mbstring.internal_encoding</code>，在 <var class="filename">php.ini</var> 里应当放置在 <code class="literal">mbstring.language</code> 之后。
     </p>
    </dd>
   
   
    <dt id="ini.mbstring.encoding-translation">
     <code class="parameter">mbstring.encoding_translation</code>
     <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span>
    </dt>
    <dd>
     <p class="para">
      为传入的 HTTP 查询启用透明字符编码过滤器，将检测和转换输入的编码为内部字符编码（internal character encoding）。
     </p>
    </dd>
   
   
    <dt id="ini.mbstring.internal-encoding">
     <code class="parameter">mbstring.internal_encoding</code>
     <span class="type"><a href="language.types.string.php" class="type string">string</a></span>
    </dt>
    <dd>
     <div class="warning"><strong class="warning">警告</strong>
      <p class="para">本过时特性<em>将</em>肯定会在未来被<em>移除</em>。</p>
     </div>
     <p class="para">
      定义内部字符的默认编码。
     </p>
     <p class="para">
      用户应该将此选项留空，并设置
      <a href="ini.core.php#ini.default-charset" class="link"><code class="parameter">default_charset</code></a>
      作为代替。
     </p>
    </dd>
   
   
    <dt id="ini.mbstring.http-input">
     <code class="parameter">mbstring.http_input</code>
     <span class="type"><a href="language.types.string.php" class="type string">string</a></span>
    </dt>
    <dd>
     <div class="warning"><strong class="warning">警告</strong>
      <p class="para">本过时特性<em>将</em>肯定会在未来被<em>移除</em>。</p>
     </div>
     <p class="para">
      定义 HTTP 输入字符的默认编码。
     </p>
     <p class="para">
      用户应该将此选项留空，并设置
      <a href="ini.core.php#ini.default-charset" class="link"><code class="parameter">default_charset</code></a>
      作为代替。
     </p>
    </dd>
   
   
    <dt id="ini.mbstring.http-output">
     <code class="parameter">mbstring.http_output</code>
     <span class="type"><a href="language.types.string.php" class="type string">string</a></span>
    </dt>
    <dd>
     <div class="warning"><strong class="warning">警告</strong>
      <p class="para">本过时特性<em>将</em>肯定会在未来被<em>移除</em>。</p>
     </div>
     <p class="para">
      定义 HTTP 输出字符的默认编码。
     </p>
     <p class="para">
      用户应该将此选项留空，并设置
      <a href="ini.core.php#ini.default-charset" class="link"><code class="parameter">default_charset</code></a>
      作为代替。
     </p>
    </dd>
   
   
    <dt id="ini.mbstring.detect-order">
     <code class="parameter">mbstring.detect_order</code>
     <span class="type"><a href="language.types.string.php" class="type string">string</a></span>
    </dt>
    <dd>
     <p class="para">
      定义字符编码的默认检测顺序。参见
      <span class="function"><a href="function.mb-detect-order.php" class="function">mb_detect_order()</a></span>。 
     </p>
    </dd>
   
   
    <dt id="ini.mbstring.substitute-character">
     <code class="parameter">mbstring.substitute_character</code>
     <span class="type"><a href="language.types.string.php" class="type string">string</a></span>
    </dt>
    <dd>
     <p class="para">
      为无效编码的字符定义替代字符。
      参见 <span class="function"><a href="function.mb-substitute-character.php" class="function">mb_substitute_character()</a></span> ，查看支持的值。
     </p>
    </dd>
   
   
    <dt id="ini.mbstring.func-overload">
     <code class="parameter">mbstring.func_overload</code>
     <span class="type"><a href="language.types.string.php" class="type string">string</a></span>
    </dt>
    <dd>
     <div class="warning"><strong class="warning">警告</strong><p class="simpara"> 本特性自 PHP 7.2.0 
起<em>废弃</em>，并且自 PHP 8.0.0 起被<em>移除</em>。
强烈建议不要使用本特性。</p></div>
     <p class="para">
      用 mbstring 对应的函数覆盖单字节版本的函数集。更多信息参见<a href="mbstring.overload.php" class="link">函数的覆盖</a>。
     </p>
     <p class="para">
      该设置仅能通过 <var class="filename">php.ini</var> 文件来修改。
     </p>
    </dd>
   
   
    <dt id="ini.mbstring.http-output-conv-mimetypes">
     <code class="parameter">mbstring.http_output_conv_mimetypes</code>
     <span class="type"><a href="language.types.string.php" class="type string">string</a></span>
    </dt>
    <dd>
     <p class="para">
     </p>
    </dd>
   
   
    <dt id="ini.mbstring.strict-detection">
     <code class="parameter">mbstring.strict_detection</code>
     <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span>
    </dt>
    <dd>
     <p class="para">
      使用严格的编码检测。有关描述和示例，参见 <span class="function"><a href="function.mb-detect-encoding.php" class="function">mb_detect_encoding()</a></span>。
     </p>
    </dd>
   
   
    <dt id="ini.mbstring.regex-retry-limit">
     <code class="parameter">mbstring.regex_retry_limit</code>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
    </dt>
    <dd>
     <p class="para">
      Limits the amount of backtracking that may be performed during one mbregex
      match.
     </p>
     <p class="para">
      此设置仅在链接的 oniguruma &gt;= 6.8.0 时生效。
     </p>
    </dd>
   
   
    <dt id="ini.mbstring.regex-stack-limit">
     <code class="parameter">mbstring.regex_stack_limit</code>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
    </dt>
    <dd>
     <p class="para">
      限制 mbstring 正则表达式的栈深度。
     </p>
    </dd>
   
  </dl>
 </p>

 <p class="para">
  根据 <a href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-accept-charset" class="link external">&raquo;&nbsp;HTML4.01 规范</a>，允许 Web 
  浏览器以页面不同的字符编码来提交表单。参见用 <span class="function"><a href="function.mb-http-input.php" class="function">mb_http_input()</a></span> 来检测浏览器使用的字符编码。 
 </p>
 <p class="para">
  尽管流行的浏览器能够根据给出的 HTML 文档合理猜测正确的编码，但如果能通过 <span class="function"><a href="function.header.php" class="function">header()</a></span> 函数在 HTTP 的
  <code class="literal">Content-Type</code> 头内或 ini 的 <a href="ini.core.php#ini.sect.data-handling" class="link">default_charset</a>
  里设置适当的 <code class="literal">charset</code> 参数则会更佳。
 </p>
 <p class="para">
  <div class="example" id="example-1">
  <p><strong>示例 #1 <var class="filename">php.ini</var> 设置例子</strong></p>
   <div class="example-contents">
<div class="annotation-interactive cdata"><pre>
; 设置默认语言
mbstring.language        = Neutral; 设置默认语言 Neutral(UTF-8) (默认的值)
mbstring.language        = English; 设置默认语言为 English 
mbstring.language        = Japanese; 设置默认语言为 Japanese

;; 设置内部的默认编码
;; 注意：请确保这个编码能被 PHP 所处理
mbstring.internal_encoding    = UTF-8  ; 设置内部的默认编码为 UTF-8

;; 启用 HTTP 输入编码的转换
mbstring.encoding_translation = On

;; 设置 HTTP 输入的默认编码
;; 注意：脚本不能修改 http_input 的设置
mbstring.http_input           = pass    ; 不转换
mbstring.http_input           = auto    ; 设置 HTTP 输入为 auto
                                ; &quot;auto&quot; 会根据 mbstring.language 自动扩展
mbstring.http_input           = SJIS    ; 设置 HTTP 输入编码为 SJIS
mbstring.http_input           = UTF-8,SJIS,EUC-JP ; 指定顺序

;; 设置 HTTP 输出的默认编码
mbstring.http_output          = pass    ; 不转换
mbstring.http_output          = UTF-8   ; 设置 HTTP 输出编码为 UTF-8

;; 设置字符编码的默认检测顺序
mbstring.detect_order         = auto    ; Set detect order to auto
mbstring.detect_order         = ASCII,JIS,UTF-8,SJIS,EUC-JP ; Specify order

;; 设置默认的替代字符
mbstring.substitute_character = 12307   ; 指定 Unicode 值
mbstring.substitute_character = none    ; 不打印字符
mbstring.substitute_character = long    ; Long 的例子： U+3000,JIS+7E7E
</pre></div>
   </div>

  </div>
 </p>
 <p class="para">
  <div class="example" id="example-2">
   <p><strong>示例 #2 <var class="filename">php.ini</var> 里 <code class="literal">EUC-JP</code> 用户的设置</strong></p>
   <div class="example-contents">
<div class="annotation-interactive cdata"><pre>
;; 禁用输出缓冲
output_buffering      = Off

;; 设置 HTTP header 字符编码
default_charset       = EUC-JP    

;; 设置默认语言为 Japanese
mbstring.language = Japanese

;; 启用 HTTP 输入编码的转换
mbstring.encoding_translation = On

;; 启用 HTTP 输入转换的编码为 auto
mbstring.http_input   = auto 

;; 转换 HTTP 输出的编码为 EUC-JP
mbstring.http_output  = EUC-JP    

;; 设置内部编码为 EUC-JP
mbstring.internal_encoding = EUC-JP    

;; 不要打印无效的字符
mbstring.substitute_character = none   
</pre></div>
   </div>

  </div>
 </p>
 <p class="para">
  <div class="example" id="example-3">
   <p><strong>示例 #3 <var class="filename">php.ini</var> 里 <code class="literal">SJIS</code> 用户的设置</strong></p>
   <div class="example-contents">
<div class="annotation-interactive cdata"><pre>
;; 启用输出缓冲
output_buffering     = On

;; 设置 mb_output_handler 来启用输出编码的转换
output_handler       = mb_output_handler

;; 设置 HTTP header 的字符编码
default_charset      = Shift_JIS

;; 设置默认语言为 Japanese
mbstring.language = Japanese

;; 设置 http 输入转换的编码为 auto
mbstring.http_input  = auto 

;; 转换成 SJIS
mbstring.http_output = SJIS    

;; 设置内部变量为 EUC-JP
mbstring.internal_encoding = EUC-JP    

;; 不要打印无效的字符
mbstring.substitute_character = none   
</pre></div>
   </div>

  </div>
 </p>

</div><?php manual_footer($setup); ?>