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"><?php<br /><br />$s </span><span style="color: #007700">= new </span><span style="color: #0000BB">SphinxClient</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$s</span><span style="color: #007700">-></span><span style="color: #0000BB">setServer</span><span style="color: #007700">(</span><span style="color: #DD0000">"localhost"</span><span style="color: #007700">, </span><span style="color: #0000BB">6712</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$s</span><span style="color: #007700">-></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">-></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 </span><span style="color: #007700">= </span><span style="color: #0000BB">$s</span><span style="color: #007700">-></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">?></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) { ["error"]=> string(0) "" ["warning"]=> string(0) "" ["status"]=> int(0) ["fields"]=> array(3) { [0]=> string(7) "subject" [1]=> string(4) "body" [2]=> string(6) "author" } ["attrs"]=> array(0) { } ["matches"]=> array(1) { [3]=> array(2) { ["weight"]=> int(1) ["attrs"]=> array(0) { } } } ["total"]=> int(1) ["total_found"]=> int(1) ["time"]=> float(0) ["words"]=> array(1) { ["to"]=> array(2) { ["docs"]=> int(1) ["hits"]=> 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 + -
显示快捷键?