mbstring.overload.html
来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 156 行
HTML
156 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Function Overloading Feature</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.supported-encodings.html">Supported Character Encodings</a></div> <div class="next" style="text-align: right; float: right;"><a href="mbstring.php4.req.html">PHP Character Encoding Requirements</a></div> <div class="up"><a href="book.mbstring.html">Multibyte String</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div> <h1> Function Overloading Feature </h1> <p class="para"> You might often find it difficult to get an existing PHP application to work in a given multibyte environment. This happens because most PHP applications out there are written with the standard string functions such as <a href="function.substr.html" class="function">substr()</a>, which are known to not properly handle multibyte-encoded strings. </p> <p class="para"> mbstring supports a 'function overloading' feature which enables you to add multibyte awareness to such an application without code modification by overloading multibyte counterparts on the standard string functions. For example, <a href="function.mb-substr.html" class="function">mb_substr()</a> is called instead of <a href="function.substr.html" class="function">substr()</a> if function overloading is enabled. This feature makes it easy to port applications that only support single-byte encodings to a multibyte environment in many cases. </p> <p class="para"> To use function overloading, set <i>mbstring.func_overload</i> in <var class="filename">php.ini</var> to a positive value that represents a combination of bitmasks specifying the categories of functions to be overloaded. It should be set to 1 to overload the <a href="function.mail.html" class="function">mail()</a> function. 2 for string functions, 4 for regular expression functions. For example, if it is set to 7, mail, strings and regular expression functions will be overloaded. The list of overloaded functions are shown below. <table border="5"> <caption><b>Functions to be overloaded</b></caption> <colgroup> <thead valign="middle"> <tr valign="middle"> <th colspan="1">value of mbstring.func_overload</th> <th colspan="1">original function</th> <th colspan="1">overloaded function</th> </tr> </thead> <tbody valign="middle" class="tbody"> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">1</td> <td colspan="1" rowspan="1" align="left"><a href="function.mail.html" class="function">mail()</a></td> <td colspan="1" rowspan="1" align="left"><a href="function.mb-send-mail.html" class="function">mb_send_mail()</a></td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">2</td> <td colspan="1" rowspan="1" align="left"><a href="function.strlen.html" class="function">strlen()</a></td> <td colspan="1" rowspan="1" align="left"><a href="function.mb-strlen.html" class="function">mb_strlen()</a></td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">2</td> <td colspan="1" rowspan="1" align="left"><a href="function.strpos.html" class="function">strpos()</a></td> <td colspan="1" rowspan="1" align="left"><a href="function.mb-strpos.html" class="function">mb_strpos()</a></td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">2</td> <td colspan="1" rowspan="1" align="left"><a href="function.strrpos.html" class="function">strrpos()</a></td> <td colspan="1" rowspan="1" align="left"><a href="function.mb-strrpos.html" class="function">mb_strrpos()</a></td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">2</td> <td colspan="1" rowspan="1" align="left"><a href="function.substr.html" class="function">substr()</a></td> <td colspan="1" rowspan="1" align="left"><a href="function.mb-substr.html" class="function">mb_substr()</a></td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">2</td> <td colspan="1" rowspan="1" align="left"><a href="function.strtolower.html" class="function">strtolower()</a></td> <td colspan="1" rowspan="1" align="left"><a href="function.mb-strtolower.html" class="function">mb_strtolower()</a></td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">2</td> <td colspan="1" rowspan="1" align="left"><a href="function.strtoupper.html" class="function">strtoupper()</a></td> <td colspan="1" rowspan="1" align="left"><a href="function.mb-strtoupper.html" class="function">mb_strtoupper()</a></td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">2</td> <td colspan="1" rowspan="1" align="left"><a href="function.substr-count.html" class="function">substr_count()</a></td> <td colspan="1" rowspan="1" align="left"><a href="function.mb-substr-count.html" class="function">mb_substr_count()</a></td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">4</td> <td colspan="1" rowspan="1" align="left"><a href="function.ereg.html" class="function">ereg()</a></td> <td colspan="1" rowspan="1" align="left"><a href="function.mb-ereg.html" class="function">mb_ereg()</a></td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">4</td> <td colspan="1" rowspan="1" align="left"><a href="function.eregi.html" class="function">eregi()</a></td> <td colspan="1" rowspan="1" align="left"><a href="function.mb-eregi.html" class="function">mb_eregi()</a></td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">4</td> <td colspan="1" rowspan="1" align="left"><a href="function.ereg-replace.html" class="function">ereg_replace()</a></td> <td colspan="1" rowspan="1" align="left"><a href="function.mb-ereg-replace.html" class="function">mb_ereg_replace()</a></td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">4</td> <td colspan="1" rowspan="1" align="left"><a href="function.eregi-replace.html" class="function">eregi_replace()</a></td> <td colspan="1" rowspan="1" align="left"><a href="function.mb-eregi-replace.html" class="function">mb_eregi_replace()</a></td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">4</td> <td colspan="1" rowspan="1" align="left"><a href="function.split.html" class="function">split()</a></td> <td colspan="1" rowspan="1" align="left"><a href="function.mb-split.html" class="function">mb_split()</a></td> </tr> </tbody> </colgroup> </table> </p> <blockquote><p><b class="note">Note</b>: It is not recommended to use the function overloading option in the per-directory context, because it's not confirmed yet to be stable enough in a production environment and may lead to undefined behaviour. <br /> </p></blockquote></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mbstring.supported-encodings.html">Supported Character Encodings</a></div> <div class="next" style="text-align: right; float: right;"><a href="mbstring.php4.req.html">PHP Character Encoding Requirements</a></div> <div class="up"><a href="book.mbstring.html">Multibyte String</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?