无需言 做自己 业 ,精于勤 荒于嬉.
- 多字节字符串 函数 mb_strrpos 查找字符串在一个字符串中最后出现的位置
-
发表日期:2021-07-01 08:55:53 | 来源: | 分类:多字节字符串 函数
-
mb_strrpos
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
mb_strrpos — 查找字符串在一个字符串中最后出现的位置
说明
mb_strrpos(
string$haystack,
string$needle,
int$offset= 0,
string$encoding= mb_internal_encoding()
): int基于字符数执行一个多字节安全的 strrpos() 操作。
needle的位置是从haystack的开始进行统计的。 第一个字符的位置是 0,第二个字符的位置是 1。参数
-
haystack -
查找
needle在这个 string 中最后出现的位置。 -
needle -
在
haystack中查找这个 string。 -
offset - 可以用于指定 string 里从任意字符数开始进行搜索。 负数的值将导致搜索会终止于指向 string 末尾的任意点。
-
encoding -
encoding参数为字符编码。如果省略或是null,则使用内部字符编码。
返回值
返回 string 的
haystack中,needle最后出现位置的数值。 如果没有找到needle,它将返回false。更新日志
版本 说明 5.2.0 增加了可选参数 offset。注释
注意: 从 PHP 5.2.0 开始,
encoding参数从第三个位置移到了第四个位置。 为实现向后兼容,可以将第三个参数指定为encoding,但不建议这么做,在将来会移除这个特性。参见
- mb_strpos() - 查找字符串在另一个字符串中首次出现的位置
- mb_internal_encoding() - 设置/获取内部字符编码
- strrpos() - 计算指定字符串在目标字符串中最后一次出现的位置
-
- 多字节字符串 函数 mb_stristr 大小写不敏感地查找字符串在另一个字符串里的首次出现
-
发表日期:2021-07-01 08:55:53 | 来源: | 分类:多字节字符串 函数
-
mb_stristr
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
mb_stristr — 大小写不敏感地查找字符串在另一个字符串里的首次出现
说明
mb_stristr(
string$haystack,
string$needle,
bool$before_needle= false,
string$encoding= mb_internal_encoding()
): stringmb_strstr() 查找了
needle在haystack中首次的出现并返回haystack的一部分。 和 mb_strstr() 不同的是,mb_stristr() 是大小写不敏感的。 如果needle没有找到,它将返回false。参数
-
haystack -
要获取
needle首次出现的字符串。 -
needle -
在
haystack中查找这个字符串。 -
before_needle -
决定这个函数返回
haystack的哪一部分。 如果设置为true,它返回haystack中从开始到needle出现位置的所有字符(不包括 needle)。 如果设置为false,它返回haystack中needle出现位置到最后的所有字符(包括了 needle)。 -
encoding -
要使用的字符编码名称。 如果省略该参数,将使用内部字符编码。
返回值
返回
haystack的一部分,或者needle没找到则返回false。 -
- 多字节字符串 函数 mb_strripos 大小写不敏感地在字符串中查找一个字符串最后出现的位置
-
发表日期:2021-07-01 08:55:53 | 来源: | 分类:多字节字符串 函数
-
mb_strripos
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
mb_strripos — 大小写不敏感地在字符串中查找一个字符串最后出现的位置
说明
mb_strripos(
string$haystack,
string$needle,
int$offset= 0,
string$encoding= mb_internal_encoding()
): intmb_strripos() 基于字符数执行一个多字节安全的 strripos() 操作。
needle的位置是从haystack的开始进行统计的。 第一个字符的位置是 0,第二个字符的位置是 1。 和 mb_strrpos() 不同的是,mb_strripos() 是大小写不敏感的。参数
-
haystack -
查找
needle在这个字符串中最后出现的位置。 -
needle -
在
haystack中查找这个字符串。 -
offset -
在
haystack中开始搜索的位置。 -
encoding -
使用的字符编码名称。如果省略了,则将使用内部编码。
返回值
返回字符串
haystack中needle最后出现位置的数值。 如果没有找到needle,它将返回false。参见
- strripos() - 计算指定字符串在目标字符串中最后一次出现的位置(不区分大小写)
- strrpos() - 计算指定字符串在目标字符串中最后一次出现的位置
- mb_strrpos() - 查找字符串在一个字符串中最后出现的位置
-
- 多字节字符串 函数 mb_strstr 查找字符串在另一个字符串里的首次出现
-
发表日期:2021-07-01 08:55:53 | 来源: | 分类:多字节字符串 函数
-
mb_strstr
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
mb_strstr — 查找字符串在另一个字符串里的首次出现
说明
mb_strstr(
string$haystack,
string$needle,
bool$before_needle= false,
string$encoding= mb_internal_encoding()
): stringmb_strstr() 查找了
needle在haystack中首次的出现并返回haystack的一部分。 如果needle没有找到,它将返回false。参数
-
haystack -
要获取
needle首次出现的字符串。 -
needle -
在
haystack中查找这个字符串。 -
before_needle -
决定这个函数返回
haystack的哪一部分。 如果设置为true,它返回haystack中从开始到needle出现位置的所有字符(不包括 needle)。 如果设置为false,它返回haystack中needle出现位置到最后的所有字符(包括了 needle)。 -
encoding -
要使用的字符编码名称。 如果省略该参数,将使用内部字符编码。
返回值
返回
haystack的一部分,或者needle没找到则返回false。 -
- 多字节字符串 函数 mb_strtolower 使字符串小写
-
发表日期:2021-07-01 08:55:53 | 来源: | 分类:多字节字符串 函数
-
示例1
<?php $str = "Mary Had A Little Lamb and She LOVED It So"; $str = mb_strtolower($str); echo $str; // 输出: mary had a little lamb and she loved it so?>
示例2
<?php $str = "Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός"; $str = mb_strtolower($str, 'UTF-8'); echo $str; // 输出 τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός?>
- 多字节字符串 函数 mb_ereg_search_getregs Retrieve the result from the last multibyte regular expression match
-
发表日期:2021-07-01 08:55:52 | 来源: | 分类:多字节字符串 函数
-
mb_ereg_search_getregs
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
mb_ereg_search_getregs — Retrieve the result from the last multibyte regular expression match
说明
mb_ereg_search_getregs(): array|falseRetrieve the result from the last multibyte regular expression match
参数
此函数没有参数。
返回值
An array including the sub-string of matched part by last mb_ereg_search(), mb_ereg_search_pos(), mb_ereg_search_regs(). If there are some matches, the first element will have the matched sub-string, the second element will have the first part grouped with brackets, the third element will have the second part grouped with brackets, and so on. It returns
falseon error.注释
注意:
mb_regex_encoding() 指定的内部编码或字符编码将会当作此函数用的字符编码。
参见
- mb_regex_encoding() - Set/Get character encoding for multibyte regex
- mb_ereg_search_init() - Setup string and regular expression for a multibyte regular expression match
- 多字节字符串 函数 mb_ereg_search_regs Returns the matched part of a multibyte regular expression
-
发表日期:2021-07-01 08:55:52 | 来源: | 分类:多字节字符串 函数
-
mb_ereg_search_regs
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
mb_ereg_search_regs — Returns the matched part of a multibyte regular expression
说明
mb_ereg_search_regs(string|null$pattern=null, string|null$options=null): array|falseReturns the matched part of a multibyte regular expression.
参数
-
pattern -
The search pattern.
-
options -
The search option. See mb_regex_set_options() for explanation.
返回值
mb_ereg_search_regs() executes the multibyte regular expression match, and if there are some matched part, it returns an array including substring of matched part as first element, the first grouped part with brackets as second element, the second grouped part as third element, and so on. It returns
falseon error.更新日志
版本 说明 8.0.0 patternandoptionsare nullable now.注释
注意:
mb_regex_encoding() 指定的内部编码或字符编码将会当作此函数用的字符编码。
参见
- mb_regex_encoding() - Set/Get character encoding for multibyte regex
- mb_ereg_search_init() - Setup string and regular expression for a multibyte regular expression match
-
- 多字节字符串 函数 mb_ereg Regular expression match with multibyte support
-
发表日期:2021-07-01 08:55:52 | 来源: | 分类:多字节字符串 函数
-
mb_ereg
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
mb_ereg — Regular expression match with multibyte support
说明
mb_ereg(string$pattern, string$string, array&$matches=null): boolExecutes the regular expression match with multibyte support.
参数
-
pattern -
The search pattern.
-
string -
The search string.
-
matches -
If matches are found for parenthesized substrings of
patternand the function is called with the third argumentmatches, the matches will be stored in the elements of the arraymatches. If no matches are found,matchesis set to an empty array.$matches[1] will contain the substring which starts at the first left parenthesis; $matches[2] will contain the substring starting at the second, and so on. $matches[0] will contain a copy of the complete string matched.
返回值
Returns whether
patternmatchesstring.更新日志
版本 说明 8.0.0 This function returns trueon success now. Previously, it returned the byte length of the matched string if a match forpatternwas found instringandmatcheswas passed. If the optional parametermatcheswas not passed or the length of the matched string was0, this function returned1.7.1.0 mb_ereg() will now set matchesto an empty array, if nothing matched. Formerly,matcheswas not modified in that case.注释
注意:
mb_regex_encoding() 指定的内部编码或字符编码将会当作此函数用的字符编码。
参见
- mb_regex_encoding() - Set/Get character encoding for multibyte regex
- mb_eregi() - Regular expression match ignoring case with multibyte support
-
- 多字节字符串 函数 mb_get_info 获取 mbstring 的内部设置
-
发表日期:2021-07-01 08:55:52 | 来源: | 分类:多字节字符串 函数
-
mb_get_info
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
mb_get_info — 获取 mbstring 的内部设置
说明
mb_get_info(string$type= "all"): mixedmb_get_info() 返回 mbstring 参数的内部设定。
参数
-
type -
如果没有设定
type或者将其设定为"all"将会返回以下内容"internal_encoding","http_input","http_output","http_output_conv_mimetypes","mail_charset","mail_header_encoding","mail_body_encoding","illegal_chars","encoding_translation","language","detect_order","substitute_character"和"strict_detection"。如果
type设定为类似"internal_encoding","http_input","http_output","http_output_conv_mimetypes","mail_charset","mail_header_encoding","mail_body_encoding","illegal_chars","encoding_translation","language","detect_order","substitute_character"或"strict_detection",将返回该参数的设置。
返回值
如果没有指定
type将返回类型信息的数组,否则将返回指定type的信息。 或者在失败时返回false。更新日志
版本 说明 8.0.0 参数 type中的"func_overload"和"func_overload_list"不再被支持。参见
- mb_regex_encoding() - Set/Get character encoding for multibyte regex
- mb_http_output() - 设置/获取 HTTP 输出字符编码
-
- 多字节字符串 函数 mb_ereg_search_setpos Set start point of next regular expression match
-
发表日期:2021-07-01 08:55:52 | 来源: | 分类:多字节字符串 函数
-
mb_ereg_search_setpos
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
mb_ereg_search_setpos — Set start point of next regular expression match
说明
mb_ereg_search_setpos(int$offset): boolmb_ereg_search_setpos() sets the starting point of a match for mb_ereg_search().
参数
-
offset -
The position to set. If it is negative, it counts from the end of the string.
返回值
成功时返回
true, 或者在失败时返回false。更新日志
版本 说明 7.1.0 Support for negative offsets has been added.注释
注意:
mb_regex_encoding() 指定的内部编码或字符编码将会当作此函数用的字符编码。
参见
- mb_regex_encoding() - Set/Get character encoding for multibyte regex
- mb_ereg_search_init() - Setup string and regular expression for a multibyte regular expression match
-
- 多字节字符串 函数 mb_http_output 设置/获取 HTTP 输出字符编码
-
发表日期:2021-07-01 08:55:52 | 来源: | 分类:多字节字符串 函数
-
mb_http_output
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
mb_http_output — 设置/获取 HTTP 输出字符编码
说明
mb_http_output(string$encoding= mb_http_output()): mixed设置/获取 HTTP 输出字符编码。此函数被调用之后输出的内容会被转换成
encoding。参数
-
encoding -
如果设置了
encoding,mb_http_output() 设置 HTTP 输出字符编码为encoding。如果省略了
encoding,mb_http_output() 返回当前的 HTTP 输出字符编码。
返回值
如果省略了
encoding,mb_http_output() 返回当前的 HTTP 输出字符编码。 否则成功时返回true, 或者在失败时返回false。参见
- mb_internal_encoding() - 设置/获取内部字符编码
- mb_http_input() - 检测 HTTP 输入字符编码
- mb_detect_order() - 设置/获取 字符编码的检测顺序
-
- 多字节字符串 函数 mb_http_input 检测 HTTP 输入字符编码
-
发表日期:2021-07-01 08:55:52 | 来源: | 分类:多字节字符串 函数
-
mb_http_input
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
mb_http_input — 检测 HTTP 输入字符编码
说明
mb_http_input(string$type= ""): mixed检测 HTTP 输入字符的编码。
参数
-
type -
设置的字符串指定了输入类型。 "G" 是 GET,"P" 是 POST,"C" 是 COOKIE,"S" 是 string,"L" 是 list,以及 "I" 是整个列表(将会返回 array)。 如果省略了 type,它将返回最后处理的一种输入类型。
返回值
每个
type的字符编码名称。 如果 mb_http_input() 没有处理过任何指定的 HTTP 输入,它将返回false。参见
- mb_internal_encoding() - 设置/获取内部字符编码
- mb_http_output() - 设置/获取 HTTP 输出字符编码
- mb_detect_order() - 设置/获取 字符编码的检测顺序
-
- 多字节字符串 函数 mb_language 设置/获取当前的语言
-
发表日期:2021-07-01 08:55:52 | 来源: | 分类:多字节字符串 函数
-
mb_language
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
mb_language — 设置/获取当前的语言
说明
mb_language(string$language= mb_language()): mixed设置/获取当前的语言。
参数
-
language -
用于编码邮件信息。有效的语言有:"Japanese","ja","English","en" 和 "uni"(UTF-8)。 mb_send_mail() 使用了该设置来对邮件进行编码。
语言和它的设置,日文是 ISO-2022-JP/Base64,uni 是 UTF-8/Base64,英文是 ISO-8859-1/quoted。
返回值
如果设置了
language,并且language是有效的,它将返回true。否则将返回false。 当省略了language参数,它将返回语言名称的 string。如果之前没有设置过语言,则将返回false。 -
- 多字节字符串 函数 mb_internal_encoding 设置/获取内部字符编码
-
发表日期:2021-07-01 08:55:52 | 来源: | 分类:多字节字符串 函数
-
示例1
<?php /* 设置内部字符编码为 UTF-8 */ mb_internal_encoding("UTF-8"); /* 显示当前的内部字符编码*/ echo mb_internal_encoding(); ?>
- 多字节字符串 函数 mb_eregi Regular expression match ignoring case with multibyte support
-
发表日期:2021-07-01 08:55:52 | 来源: | 分类:多字节字符串 函数
-
mb_eregi
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
mb_eregi — Regular expression match ignoring case with multibyte support
说明
mb_eregi(string$pattern, string$string, array&$matches=null): boolExecutes the case insensitive regular expression match with multibyte support.
参数
-
pattern -
The regular expression pattern.
-
string -
The string being searched.
-
matches -
If matches are found for parenthesized substrings of
patternand the function is called with the third argumentmatches, the matches will be stored in the elements of the arraymatches. If no matches are found,matchesis set to an empty array.$matches[1] will contain the substring which starts at the first left parenthesis; $matches[2] will contain the substring starting at the second, and so on. $matches[0] will contain a copy of the complete string matched.
返回值
Returns whether
patternmatchesstring.更新日志
版本 说明 8.0.0 This function returns trueon success now. Previously, it returned the byte length of the matched string if a match forpatternwas found instringandmatcheswas passed. If the optional parametermatcheswas not passed or the length of the matched string was0, this function returned1.7.1.0 mb_eregi() will now set matchesto an empty array, if nothing matched. Formerly,matcheswas not modified in that case.注释
注意:
mb_regex_encoding() 指定的内部编码或字符编码将会当作此函数用的字符编码。
参见
- mb_regex_encoding() - Set/Get character encoding for multibyte regex
- mb_ereg() - Regular expression match with multibyte support
-
- 多字节字符串 函数 mb_eregi_replace Replace regular expression with multibyte support ignoring case
-
发表日期:2021-07-01 08:55:52 | 来源: | 分类:多字节字符串 函数
-
mb_eregi_replace
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
mb_eregi_replace — Replace regular expression with multibyte support ignoring case
说明
mb_eregi_replace(
string$pattern,
string$replacement,
string$string,
string|null$options=null
): string|false|nullScans
stringfor matches topattern, then replaces the matched text withreplacement.参数
-
pattern -
The regular expression pattern. Multibyte characters may be used. The case will be ignored.
-
replacement -
The replacement text.
-
string -
The searched string.
-
options - The search option. See mb_regex_set_options() for explanation.
返回值
The resultant string or
falseon error. Ifstringis not valid for the current encoding,nullis returned.更新日志
版本 说明 8.0.0 optionsis nullable now.7.1.0 The function checks whether stringis valid for the current encoding.7.1.0 The emodifier has been deprecated.注释
注意:
mb_regex_encoding() 指定的内部编码或字符编码将会当作此函数用的字符编码。
警告处理非信任的输入时从不使用
e修饰符,就不会转码(即调用 preg_replace())。不注意这些会很可能会导致应用程序引发远程代码执行的漏洞。参见
- mb_regex_encoding() - Set/Get character encoding for multibyte regex
- mb_ereg_replace() - Replace regular expression with multibyte support
-
- 多字节字符串 函数 mb_output_handler 在输出缓冲中转换字符编码的回调函数
-
发表日期:2021-07-01 08:55:52 | 来源: | 分类:多字节字符串 函数
-
示例1
<?php mb_http_output("UTF-8"); ob_start("mb_output_handler"); ?>
- 多字节字符串 函数 mb_list_encodings 返回所有支持编码的数组
-
发表日期:2021-07-01 08:55:52 | 来源: | 分类:多字节字符串 函数
-
示例1
<?php print_r(mb_list_encodings()); ?>
- 多字节字符串 函数 mb_preferred_mime_name 获取 MIME 字符串
-
发表日期:2021-07-01 08:55:52 | 来源: | 分类:多字节字符串 函数
-
示例1
<?php $outputenc = "sjis-win"; mb_http_output($outputenc); ob_start("mb_output_handler"); header("Content-Type: text/html; charset=" . mb_preferred_mime_name($outputenc)); ?>
- 多字节字符串 函数 mb_parse_str 解析 GET/POST/COOKIE 数据并设置全局变量
-
发表日期:2021-07-01 08:55:52 | 来源: | 分类:多字节字符串 函数
-
mb_parse_str
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
mb_parse_str — 解析 GET/POST/COOKIE 数据并设置全局变量
说明
mb_parse_str(string$encoded_string, array&$result= ?): bool解析 GET/POST/COOKIE 数据并设置全局变量。 由于 PHP 不提供原始 POST/COOKIE 数据,目前它仅能够用于 GET 数据。 它解析了 URL 编码过的数据,检测其编码,并转换编码为内部编码,然后设置其值为 array 的
result或者全局变量。参数
-
encoded_string -
URL 编码过的数据。
-
result -
一个 array,包含解码过的、编码转换后的值。
返回值
成功时返回
true, 或者在失败时返回false。 -
- 前端开发(1)
- 数据库(0)
- PHP(0)
- PHP杂项(34)
- PHP基础-李炎恢系列课程(20)
- 中文函数手册(0)
- 错误处理 函数(13)
- OPcache 函数(6)
- PHP 选项/信息 函数(54)
- Zip 函数(10)
- Hash 函数(15)
- OpenSSL 函数(63)
- Date/Time 函数(51)
- 目录函数(9)
- Fileinfo 函数(6)
- iconv 函数(11)
- 文件系统函数(81)
- 多字节字符串 函数(57)
- GD 和图像处理 函数(114)
- 可交换图像信息(5)
- Math 函数(50)
- 程序执行函数(11)
- PCNTL 函数(23)
- JSON 函数(4)
- SPL 函数(15)
- URL 函数(10)
- cURL 函数(32)
- 网络 函数(33)
- FTP 函数(36)
- Session 函数(23)
- PCRE 函数(11)
- PCRE 正则语法(19)
- 数组 函数(81)
- 类/对象 函数(18)
- 函数处理 函数(13)
- 变量处理 函数(37)
- SimpleXML 函数(3)
- 杂项 函数(31)
- 字符串 函数(101)
- JAVA(0)
- Android(0)
- Linux(0)
- AI大模型(9)
- 其他(0)
宁公网安备 64010402001209号