mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 05:26:57 +08:00
118 lines
4.4 KiB
HTML
118 lines
4.4 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-strstr" class="refentry">
|
||
<div class="refnamediv">
|
||
<h1 class="refname">mb_strstr</h1>
|
||
<p class="verinfo">(PHP 5 >= 5.2.0, PHP 7)</p><p class="refpurpose"><span class="refname">mb_strstr</span> — <span class="dc-title">查找字符串在另一个字符串里的首次出现</span></p>
|
||
|
||
</div>
|
||
<div class="refsect1 description" id="refsect1-function.mb-strstr-description">
|
||
<h3 class="title">说明</h3>
|
||
<div class="methodsynopsis dc-description">
|
||
<span class="methodname"><strong>mb_strstr</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">bool</span> <code class="parameter">$before_needle</code><span class="initializer"> = false</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">string</span></div>
|
||
|
||
<p class="para rdfs-comment">
|
||
<span class="function"><strong>mb_strstr()</strong></span> 查找了 <code class="parameter">needle</code> 在 <code class="parameter">haystack</code> 中首次的出现并返回 <code class="parameter">haystack</code> 的一部分。
|
||
如果 <code class="parameter">needle</code> 没有找到,它将返回 <strong><code>FALSE</code></strong>。
|
||
</p>
|
||
</div>
|
||
|
||
<div class="refsect1 parameters" id="refsect1-function.mb-strstr-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> 首次出现的字符串。
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">needle</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
在 <code class="parameter">haystack</code> 中查找这个字符串。
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">before_needle</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
决定这个函数返回 <code class="parameter">haystack</code> 的哪一部分。
|
||
如果设置为 <strong><code>TRUE</code></strong>,它返回 <code class="parameter">haystack</code> 中从开始到 <code class="parameter">needle</code> 出现位置的所有字符(不包括 needle)。
|
||
如果设置为 <strong><code>FALSE</code></strong>,它返回 <code class="parameter">haystack</code> 中 <code class="parameter">needle</code> 出现位置到最后的所有字符(包括了 needle)。
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">encoding</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
要使用的字符编码名称。
|
||
如果省略该参数,将使用内部字符编码。
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
</dl>
|
||
|
||
</p>
|
||
</div>
|
||
|
||
<div class="refsect1 returnvalues" id="refsect1-function.mb-strstr-returnvalues">
|
||
<h3 class="title">返回值</h3>
|
||
<p class="para">
|
||
返回 <code class="parameter">haystack</code> 的一部分,或者 <code class="parameter">needle</code> 没找到则返回 <strong><code>FALSE</code></strong>。
|
||
</p>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<div class="refsect1 seealso" id="refsect1-function.mb-strstr-seealso">
|
||
<h3 class="title">参见</h3>
|
||
<p class="para">
|
||
<ul class="simplelist">
|
||
<li class="member"><span class="function"><a href="stristr.html" class="function" rel="rdfs-seeAlso">stristr()</a> - strstr 函数的忽略大小写版本</span></li>
|
||
<li class="member"><span class="function"><a href="strstr.html" class="function" rel="rdfs-seeAlso">strstr()</a> - 查找字符串的首次出现</span></li>
|
||
<li class="member"><span class="function"><a href="mb_stristr.html" class="function" rel="rdfs-seeAlso">mb_stristr()</a> - 大小写不敏感地查找字符串在另一个字符串里的首次出现</span></li>
|
||
</ul>
|
||
</p>
|
||
</div>
|
||
|
||
</div></div></div></body></html> |