mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-19 06:16:58 +08:00
151 lines
5.5 KiB
HTML
151 lines
5.5 KiB
HTML
<!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.mb-strrpos" class="refentry">
|
||
<div class="refnamediv">
|
||
<h1 class="refname">mb_strrpos</h1>
|
||
<p class="verinfo">(PHP 4 >= 4.0.6, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">mb_strrpos</span> — <span class="dc-title">查找字符串在一个字符串中最后出现的位置</span></p>
|
||
|
||
</div>
|
||
|
||
<div class="refsect1 description" id="refsect1-function.mb-strrpos-description">
|
||
<h3 class="title">说明</h3>
|
||
<div class="methodsynopsis dc-description">
|
||
<span class="methodname"><strong>mb_strrpos</strong></span>
|
||
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$haystack</code></span>
|
||
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$needle</code></span>
|
||
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$offset</code><span class="initializer"> = 0</span></span>
|
||
[, <span class="methodparam"><span class="type">string</span> <code class="parameter">$encoding</code><span class="initializer"> = mb_internal_encoding()</span></span>
|
||
]] ) : <span class="type">int</span></div>
|
||
|
||
<p class="para rdfs-comment">
|
||
基于字符数执行一个多字节安全的 <span class="function"><a href="strrpos.html" class="function">strrpos()</a></span> 操作。
|
||
<code class="parameter">needle</code> 的位置是从 <code class="parameter">haystack</code> 的开始进行统计的。
|
||
第一个字符的位置是 0,第二个字符的位置是 1。
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 parameters" id="refsect1-function.mb-strrpos-parameters">
|
||
<h3 class="title">参数</h3>
|
||
<p class="para">
|
||
<dl>
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">haystack</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
查找 <code class="parameter">needle</code> 在这个 <span class="type"><a href="language.types.string.html" class="type string">string</a></span> 中最后出现的位置。
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">needle</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
在 <code class="parameter">haystack</code> 中查找这个 <span class="type"><a href="language.types.string.html" class="type string">string</a></span>。
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">offset</code></dt>
|
||
|
||
<dd>
|
||
|
||
<span class="simpara">
|
||
可以用于指定 <span class="type"><a href="language.types.string.html" class="type string">string</a></span> 里从任意字符数开始进行搜索。
|
||
负数的值将导致搜索会终止于指向 <span class="type"><a href="language.types.string.html" class="type string">string</a></span> 末尾的任意点。
|
||
</span>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">encoding</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para"><code class="parameter">encoding</code>
|
||
参数为字符编码。如果省略,则使用内部字符编码。</p>
|
||
</dd>
|
||
|
||
|
||
</dl>
|
||
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 returnvalues" id="refsect1-function.mb-strrpos-returnvalues">
|
||
<h3 class="title">返回值</h3>
|
||
<p class="para">
|
||
返回 <span class="type"><a href="language.types.string.html" class="type string">string</a></span> 的 <code class="parameter">haystack</code> 中,<code class="parameter">needle</code> 最后出现位置的数值。
|
||
如果没有找到 <code class="parameter">needle</code>,它将返回 <strong><code>FALSE</code></strong>。
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 changelog" id="refsect1-function.mb-strrpos-changelog">
|
||
<h3 class="title">更新日志</h3>
|
||
<p class="para">
|
||
<table class="doctable informaltable">
|
||
|
||
<thead>
|
||
<tr>
|
||
<th>版本</th>
|
||
<th>说明</th>
|
||
</tr>
|
||
|
||
</thead>
|
||
|
||
<tbody class="tbody">
|
||
<tr>
|
||
<td>5.2.0</td>
|
||
<td>增加了可选参数 <code class="parameter">offset</code>。</td>
|
||
</tr>
|
||
|
||
</tbody>
|
||
|
||
</table>
|
||
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 notes" id="refsect1-function.mb-strrpos-notes">
|
||
<h3 class="title">注释</h3>
|
||
<blockquote class="note"><p><strong class="note">Note</strong>:
|
||
<span class="simpara">
|
||
从 PHP 5.2.0 开始,<code class="parameter">encoding</code> 参数从第三个位置移到了第四个位置。
|
||
为实现向后兼容,可以将第三个参数指定为 <code class="parameter">encoding</code>,但不建议这么做,在将来会移除这个特性。
|
||
</span>
|
||
</p></blockquote>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 seealso" id="refsect1-function.mb-strrpos-seealso">
|
||
<h3 class="title">参见</h3>
|
||
<p class="para">
|
||
<ul class="simplelist">
|
||
<li class="member"><span class="function"><a href="mb_strpos.html" class="function" rel="rdfs-seeAlso">mb_strpos()</a> - 查找字符串在另一个字符串中首次出现的位置</span></li>
|
||
<li class="member"><span class="function"><a href="mb_internal_encoding.html" class="function" rel="rdfs-seeAlso">mb_internal_encoding()</a> - 设置/获取内部字符编码</span></li>
|
||
<li class="member"><span class="function"><a href="strrpos.html" class="function" rel="rdfs-seeAlso">strrpos()</a> - 计算指定字符串在目标字符串中最后一次出现的位置</span></li>
|
||
</ul>
|
||
</p>
|
||
</div>
|
||
|
||
|
||
</div></div></div></body></html> |