sphinx.examples.html

来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 85 行

HTML
85
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Examples</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="sphinx.constants.html">Predefined Constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="class.sphinxclient.html">SphinxClient</a></div> <div class="up"><a href="book.sphinx.html">Sphinx</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div> <h1>Examples</h1> <div class="example">  <p><b>Example #1 Basic usage example</b></p>  <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$s&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">SphinxClient</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setServer</span><span style="color: #007700">(</span><span style="color: #DD0000">"localhost"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">6712</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setMatchMode</span><span style="color: #007700">(</span><span style="color: #0000BB">SPH_MATCH_ANY</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setMaxQueryTime</span><span style="color: #007700">(</span><span style="color: #0000BB">3</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"test"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>  </div>  <div class="example-contents"><p>The above example will output something similar to:</p></div>  <div class="example-contents"><pre><div class="cdata"><pre>array(10) {  [&quot;error&quot;]=&gt;  string(0) &quot;&quot;  [&quot;warning&quot;]=&gt;  string(0) &quot;&quot;  [&quot;status&quot;]=&gt;  int(0)  [&quot;fields&quot;]=&gt;  array(3) {    [0]=&gt;    string(7) &quot;subject&quot;    [1]=&gt;    string(4) &quot;body&quot;    [2]=&gt;    string(6) &quot;author&quot;  }  [&quot;attrs&quot;]=&gt;  array(0) {  }  [&quot;matches&quot;]=&gt;  array(1) {    [3]=&gt;    array(2) {      [&quot;weight&quot;]=&gt;      int(1)      [&quot;attrs&quot;]=&gt;      array(0) {      }    }  }  [&quot;total&quot;]=&gt;  int(1)  [&quot;total_found&quot;]=&gt;  int(1)  [&quot;time&quot;]=&gt;  float(0)  [&quot;words&quot;]=&gt;  array(1) {    [&quot;to&quot;]=&gt;    array(2) {      [&quot;docs&quot;]=&gt;      int(1)      [&quot;hits&quot;]=&gt;      int(1)    }  }}</pre></div>  </pre></div> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="sphinx.constants.html">Predefined Constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="class.sphinxclient.html">SphinxClient</a></div> <div class="up"><a href="book.sphinx.html">Sphinx</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?