⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 function.yaz-scan.html

📁 php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Prepares for a scan</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="function.yaz-scan-result.html">yaz_scan_result</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.yaz-schema.html">yaz_schema</a></div> <div class="up"><a href="ref.yaz.html">YAZ Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.yaz-scan" class="refentry"> <div class="refnamediv">  <h1 class="refname">yaz_scan</h1>  <p class="verinfo">(PHP 4 &gt;= 4.0.5, PECL yaz:0.9-1.0.9)</p><p class="refpurpose"><span class="refname">yaz_scan</span> &mdash; <span class="dc-title">Prepares for a scan</span></p> </div> <div class="refsect1 description">  <h3 class="title">Description</h3>  <div class="methodsynopsis dc-description">   <span class="type"><span class="type void">void</span></span> <span class="methodname"><b><b>yaz_scan</b></b></span>    ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$id</tt></span>   , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$type</tt></span>   , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$startterm</tt></span>   [, <span class="methodparam"><span class="type">array</span> <tt class="parameter">$flags</tt></span>  ] )</div>  <p class="para rdfs-comment">   This function prepares for a Z39.50 Scan Request on the specified    connection.  </p>  <p class="para">   To actually transfer the Scan Request to the server and receive the   Scan Response, <a href="function.yaz-wait.html" class="function">yaz_wait()</a> must be called. Upon   completion of <a href="function.yaz-wait.html" class="function">yaz_wait()</a> call   <a href="function.yaz-error.html" class="function">yaz_error()</a> and <a href="function.yaz-scan-result.html" class="function">yaz_scan_result()</a> to   handle the response.  </p> </div> <div class="refsect1 parameters">  <h3 class="title">Parameters</h3>  <p class="para">   <dl>    <dt>     <span class="term"><i><tt class="parameter">id</tt></i></span>     <dd>      <p class="para">       The connection resource returned by <a href="function.yaz-connect.html" class="function">yaz_connect()</a>.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">type</tt></i></span>     <dd>      <p class="para">       Currently only type <i>rpn</i> is supported.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">startterm</tt></i></span>     <dd>      <p class="para">       Starting term point for the scan.      </p>      <p class="para">       The form in which the starting term is specified is given by parameter       <i><tt class="parameter">type</tt></i>.      </p>      <p class="para">       The syntax this parameter is similar to the RPN query as described in       <a href="function.yaz-search.html" class="function">yaz_search()</a>. It consists of zero or more        <i>@attr</i>-operator specifications, then followed by        exactly one token.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">flags</tt></i></span>     <dd>      <p class="para">       This optional parameter specifies additional information to control        the behaviour of the scan request. Three indexes are currently read        from the flags array:       <i>number</i> (number of terms requested),       <i>position</i> (preferred position of term) and       <i>stepSize</i> (preferred step size).      </p>     </dd>    </dt>   </dl>  </p> </div> <div class="refsect1 returnvalues">  <h3 class="title">Return Values</h3>  <p class="para">   No value is returned.  </p> </div> <div class="refsect1 examples">  <h3 class="title">Examples</h3>  <p class="para">   <div class="example">    <p><b>Example #1 PHP function that scans titles</b></p>    <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">scan_titles</span><span style="color: #007700">(</span><span style="color: #0000BB">$id</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$startterm</span><span style="color: #007700">)&nbsp;<br />{<br />&nbsp;&nbsp;</span><span style="color: #0000BB">yaz_scan</span><span style="color: #007700">(</span><span style="color: #0000BB">$id</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"rpn"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"@attr&nbsp;1=4&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$startterm</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">yaz_wait</span><span style="color: #007700">();<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$errno&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">yaz_errno</span><span style="color: #007700">(</span><span style="color: #0000BB">$id</span><span style="color: #007700">);<br />&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">$errno&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$ar&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">yaz_scan_result</span><span style="color: #007700">(</span><span style="color: #0000BB">$id</span><span style="color: #007700">,&nbsp;&amp;</span><span style="color: #0000BB">$options</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'Scan&nbsp;ok;&nbsp;'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;(</span><span style="color: #0000BB">$options&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">$key&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">$val</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"$key&nbsp;=&nbsp;$val&nbsp;&amp;nbsp;"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'&lt;br&nbsp;/&gt;&lt;table&gt;'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;(list(</span><span style="color: #0000BB">$key</span><span style="color: #007700">,&nbsp;list(</span><span style="color: #0000BB">$k</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$term</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$tcount</span><span style="color: #007700">))&nbsp;=&nbsp;</span><span style="color: #0000BB">each</span><span style="color: #007700">(</span><span style="color: #0000BB">$ar</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(empty(</span><span style="color: #0000BB">$k</span><span style="color: #007700">))&nbsp;continue;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"&lt;tr&gt;&lt;td&gt;$term&lt;/td&gt;&lt;td&gt;$tcount&lt;/td&gt;&lt;/tr&gt;"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'&lt;/table&gt;'</span><span style="color: #007700">;<br />&nbsp;&nbsp;}&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Scan&nbsp;failed.&nbsp;Error:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">yaz_error</span><span style="color: #007700">(</span><span style="color: #0000BB">$id</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"&lt;br&nbsp;/&gt;"</span><span style="color: #007700">;<br />&nbsp;&nbsp;}<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>    </div>   </div>  </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.yaz-scan-result.html">yaz_scan_result</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.yaz-schema.html">yaz_schema</a></div> <div class="up"><a href="ref.yaz.html">YAZ Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

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