📄 mbstring.configuration.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Runtime Configuration</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mbstring.installation.html">Installation</a></div> <div class="next" style="text-align: right; float: right;"><a href="mbstring.resources.html">Resource Types</a></div> <div class="up"><a href="mbstring.setup.html">Installing/Configuring</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="mbstring.configuration" class="section"> <h2 class="title">Runtime Configuration</h2> <p class="simpara">The behaviour of these functions is affected by settings in <var class="filename">php.ini</var>.</p> <p class="para"> <table border="5"> <caption><b>mbstring configuration options</b></caption> <colgroup> <thead valign="middle"> <tr valign="middle"> <th colspan="1">Name</th> <th colspan="1">Default</th> <th colspan="1">Changeable</th> <th colspan="1">Changelog</th> </tr> </thead> <tbody valign="middle" class="tbody"> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">mbstring.language</td> <td colspan="1" rowspan="1" align="left">"neutral"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_PERDIR</td> <td colspan="1" rowspan="1" align="left">Available since PHP 4.3.0.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">mbstring.detect_order</td> <td colspan="1" rowspan="1" align="left">NULL</td> <td colspan="1" rowspan="1" align="left">PHP_INI_ALL</td> <td colspan="1" rowspan="1" align="left">Available since PHP 4.0.6.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">mbstring.http_input</td> <td colspan="1" rowspan="1" align="left">"pass"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_ALL</td> <td colspan="1" rowspan="1" align="left">Available since PHP 4.0.6.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">mbstring.http_output</td> <td colspan="1" rowspan="1" align="left">"pass"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_ALL</td> <td colspan="1" rowspan="1" align="left">Available since PHP 4.0.6.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">mbstring.internal_encoding</td> <td colspan="1" rowspan="1" align="left">NULL</td> <td colspan="1" rowspan="1" align="left">PHP_INI_ALL</td> <td colspan="1" rowspan="1" align="left">Available since PHP 4.0.6.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">mbstring.script_encoding</td> <td colspan="1" rowspan="1" align="left">NULL</td> <td colspan="1" rowspan="1" align="left">PHP_INI_ALL</td> <td colspan="1" rowspan="1" align="left">Available since PHP 4.3.0.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">mbstring.substitute_character</td> <td colspan="1" rowspan="1" align="left">NULL</td> <td colspan="1" rowspan="1" align="left">PHP_INI_ALL</td> <td colspan="1" rowspan="1" align="left">Available since PHP 4.0.6.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">mbstring.func_overload</td> <td colspan="1" rowspan="1" align="left">"0"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_PERDIR</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM in PHP <= 4.2.3. Available since PHP 4.2.0.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">mbstring.encoding_translation</td> <td colspan="1" rowspan="1" align="left">"0"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_PERDIR</td> <td colspan="1" rowspan="1" align="left">Available since PHP 4.3.0.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">mbstring.strict_detection</td> <td colspan="1" rowspan="1" align="left">"0"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_ALL</td> <td colspan="1" rowspan="1" align="left">Available since PHP 5.1.2.</td> </tr> </tbody> </colgroup> </table> For the definition of the PHP_INI_* constants, please refer to <a href="function.ini-set.html" class="function">ini_set()</a>. </p> <p class="para">Here's a short explanation ofthe configuration directives.</p> <p class="para"> <dl> <dt id="ini.mbstring.language"> <span class="term"> <i><tt class="parameter">mbstring.language</tt></i> <a href="language.types.string.html" class="type string">string</a> </span> <dd> <p class="para"> The default national language setting (NLS) used in mbstring. Note that this option automagically defines <i>mbstring.internal_encoding</i> and <i>mbstring.internal_encoding</i> should be placed after <i>mbstring.language</i> in <var class="filename">php.ini</var> </p> </dd> </dt> <dt id="ini.mbstring.encoding-translation"> <span class="term"> <i><tt class="parameter">mbstring.encoding_translation</tt></i> <a href="language.types.boolean.html" class="type boolean">boolean</a> </span> <dd> <p class="para"> Enables the transparent character encoding filter for the incoming HTTP queries, which performs detection and conversion of the input encoding to the internal character encoding. </p> </dd> </dt> <dt id="ini.mbstring.internal-encoding"> <span class="term"> <i><tt class="parameter">mbstring.internal_encoding</tt></i> <a href="language.types.string.html" class="type string">string</a> </span> <dd> <p class="para"> Defines the default internal character encoding. </p> </dd> </dt> <dt id="ini.mbstring.http-input"> <span class="term"> <i><tt class="parameter">mbstring.http_input</tt></i> <a href="language.types.string.html" class="type string">string</a> </span> <dd> <p class="para"> Defines the default HTTP input character encoding. </p> </dd> </dt> <dt id="ini.mbstring.http-output"> <span class="term"> <i><tt class="parameter">mbstring.http_output</tt></i> <a href="language.types.string.html" class="type string">string</a> </span> <dd> <p class="para"> Defines the default HTTP output character encoding. </p> </dd> </dt> <dt id="ini.mbstring.detect-order"> <span class="term"> <i><tt class="parameter">mbstring.detect_order</tt></i> <a href="language.types.string.html" class="type string">string</a> </span> <dd> <p class="para"> Defines default character code detection order. See also <a href="function.mb-detect-order.html" class="function">mb_detect_order()</a>. </p> </dd> </dt> <dt id="ini.mbstring.substitute-character"> <span class="term"> <i><tt class="parameter">mbstring.substitute_character</tt></i> <a href="language.types.string.html" class="type string">string</a> </span> <dd> <p class="para"> Defines character to substitute for invalid character encoding. </p> </dd> </dt> <dt id="ini.mbstring.func-overload"> <span class="term"> <i><tt class="parameter">mbstring.func_overload</tt></i> <a href="language.types.string.html" class="type string">string</a> </span> <dd> <p class="para"> Overloads a set of single byte functions by the mbstring counterparts. See <a href="mbstring.overload.html" class="link">Function overloading</a> for more information. </p> </dd> </dt> <dt id="ini.mbstring.strict-detection"> <span class="term"> <i><tt class="parameter">mbstring.strict_detection</tt></i> <a href="language.types.boolean.html" class="type boolean">boolean</a> </span> <dd> <p class="para"> Enables the strict encoding detection. </p> </dd> </dt> </dl> </p> <p class="para"> According to the <a href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-accept-charset" class="link external">» HTML 4.01 specification</a>, Web browsers are allowed to encode a form being submitted with a character encoding different from the one used for the page. See <a href="function.mb-http-input.html" class="function">mb_http_input()</a> to detect character encoding used by browsers. </p> <p class="para"> Although popular browsers are capable of giving a reasonably accurate guess to the character encoding of a given HTML document, it would be better to set the <i>charset</i> parameter in the <i>Content-Type</i> HTTP header to the appropriate value by <a href="function.header.html" class="function">header()</a> or <a href="ini.core.html#ini.sect.data-handling" class="link">default_charset</a> ini setting. </p> <p class="para"> <div class="example"> <p><b>Example #1 <var class="filename">php.ini</var> setting examples</b></p> <div class="example-contents"><div class="cdata"><pre>; Set default languagembstring.language = Neutral; Set default language to Neutral(UTF-8) (default)mbstring.language = English; Set default language to English mbstring.language = Japanese; Set default language to Japanese;; Set default internal encoding;; Note: Make sure to use character encoding works with PHPmbstring.internal_encoding = UTF-8 ; Set internal encoding to UTF-8;; HTTP input encoding translation is enabled.mbstring.encoding_translation = On;; Set default HTTP input character encoding;; Note: Script cannot change http_input setting.mbstring.http_input = pass ; No conversion. mbstring.http_input = auto ; Set HTTP input to auto ; "auto" is expanded to "ASCII,JIS,UTF-8,EUC-JP,SJIS"mbstring.http_input = SJIS ; Set HTTP2 input to SJISmbstring.http_input = UTF-8,SJIS,EUC-JP ; Specify order;; Set default HTTP output character encoding mbstring.http_output = pass ; No conversionmbstring.http_output = UTF-8 ; Set HTTP output encoding to UTF-8;; Set default character encoding detection ordermbstring.detect_order = auto ; Set detect order to autombstring.detect_order = ASCII,JIS,UTF-8,SJIS,EUC-JP ; Specify order;; Set default substitute charactermbstring.substitute_character = 12307 ; Specify Unicode valuembstring.substitute_character = none ; Do not print charactermbstring.substitute_character = long ; Long Example: U+3000,JIS+7E7E</pre></div> </div> </div> </p> <p class="para"> <div class="example"> <p><b>Example #2 <var class="filename">php.ini</var> setting for <i>EUC-JP</i> users</b></p> <div class="example-contents"><div class="cdata"><pre>;; Disable Output Bufferingoutput_buffering = Off;; Set HTTP header charsetdefault_charset = EUC-JP ;; Set default language to Japanesembstring.language = Japanese;; HTTP input encoding translation is enabled.mbstring.encoding_translation = On;; Set HTTP input encoding conversion to autombstring.http_input = auto ;; Convert HTTP output to EUC-JPmbstring.http_output = EUC-JP ;; Set internal encoding to EUC-JPmbstring.internal_encoding = EUC-JP ;; Do not print invalid charactersmbstring.substitute_character = none </pre></div> </div> </div> </p> <p class="para"> <div class="example"> <p><b>Example #3 <var class="filename">php.ini</var> setting for <i>SJIS</i> users</b></p> <div class="example-contents"><div class="cdata"><pre>;; Enable Output Bufferingoutput_buffering = On;; Set mb_output_handler to enable output conversionoutput_handler = mb_output_handler;; Set HTTP header charsetdefault_charset = Shift_JIS;; Set default language to Japanesembstring.language = Japanese;; Set http input encoding conversion to autombstring.http_input = auto ;; Convert to SJISmbstring.http_output = SJIS ;; Set internal encoding to EUC-JPmbstring.internal_encoding = EUC-JP ;; Do not print invalid charactersmbstring.substitute_character = none </pre></div> </div> </div> </p></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mbstring.installation.html">Installation</a></div> <div class="next" style="text-align: right; float: right;"><a href="mbstring.resources.html">Resource Types</a></div> <div class="up"><a href="mbstring.setup.html">Installing/Configuring</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -