📄 function.udm-load-ispell-data.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Load ispell data</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.udm-hash32.html">udm_hash32</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.udm-open-stored.html">udm_open_stored</a></div> <div class="up"><a href="ref.mnogosearch.html">mnoGoSearch Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.udm-load-ispell-data" class="refentry"> <div class="refnamediv"> <h1 class="refname">udm_load_ispell_data</h1> <p class="verinfo">(PHP 4 >= 4.0.5, PHP 5 <= 5.0.5, PECL mnogosearch:1.0.0)</p><p class="refpurpose"><span class="refname">udm_load_ispell_data</span> — <span class="dc-title">Load ispell data</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><b><b>udm_load_ispell_data</b></b></span> ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$agent</tt></span> , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$var</tt></span> , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$val1</tt></span> , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$val2</tt></span> , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$flag</tt></span> )</div> <p class="para rdfs-comment"> <b>udm_load_ispell_data()</b> loads ispell data. </p> <p class="para"> After using this function to free memory allocated for ispell data, please use <a href="function.udm-free-ispell-data.html" class="function">udm_free_ispell_data()</a>, even if you use UDM_ISPELL_TYPE_SERVER mode. </p> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">agent</tt></i></span> <dd> <p class="para"> A link to Agent, received after call to <a href="function.udm-alloc-agent.html" class="function">udm_alloc_agent()</a>. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">var</tt></i></span> <dd> <p class="para"> Indicates the source for ispell data. May have the following values: <ul class="itemizedlist"> <li class="listitem"> <span class="simpara"> UDM_ISPELL_TYPE_DB - indicates that ispell data should be loaded from SQL. In this case, parameters <i><tt class="parameter">val1</tt></i> and <i><tt class="parameter">val2</tt></i> are ignored and should be left blank. <i><tt class="parameter">flag</tt></i> should be equal to <i>1</i>. </span> <blockquote><p><b class="note">Note</b>: <i><tt class="parameter">flag</tt></i> indicates that after loading ispell data from defined source it should be sorted (it is necessary for correct functioning of ispell). In case of loading ispell data from files there may be several calls to <b>udm_load_ispell_data()</b>, and there is no sense to sort data after every call, but only after the last one. Since in db mode all the data is loaded by one call, this parameter should have the value <i>1</i>. In this mode in case of error, e.g. if ispell tables are absent, the function will return <b><tt>FALSE</tt></b> and code and error message will be accessible through <a href="function.udm-error.html" class="function">udm_error()</a> and <a href="function.udm-errno.html" class="function">udm_errno()</a>. <br /> </p></blockquote> </li> <li class="listitem"> <p class="para"> UDM_ISPELL_TYPE_AFFIX - indicates that ispell data should be loaded from file and initiates loading affixes file. In this case <i><tt class="parameter">val1</tt></i> defines double letter language code for which affixes are loaded, and <i><tt class="parameter">val2</tt></i> - file path. Please note, that if a relative path entered, the module looks for the file not in UDM_CONF_DIR, but in relation to current path, i.e. to the path where the script is executed. In case of error in this mode, e.g. if file is absent, the function will return <b><tt>FALSE</tt></b>, and an error message will be displayed. Error message text cannot be accessed through <a href="function.udm-error.html" class="function">udm_error()</a> and <a href="function.udm-errno.html" class="function">udm_errno()</a>, since those functions can only return messages associated with SQL. Please, see <i><tt class="parameter">flag</tt></i> parameter description in UDM_ISPELL_TYPE_DB. </p> <p class="para"> <div class="example"> <p><b>Example #1 <b>udm_load_ispell_data()</b> example</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br /></span><span style="color: #007700">if ((! </span><span style="color: #0000BB">udm_load_ispell_data</span><span style="color: #007700">(</span><span style="color: #0000BB">$udm</span><span style="color: #007700">, </span><span style="color: #0000BB">UDM_ISPELL_TYPE_AFFIX</span><span style="color: #007700">, </span><span style="color: #DD0000">'en'</span><span style="color: #007700">, </span><span style="color: #DD0000">'/opt/ispell/en.aff'</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">)) ||<br /> (! </span><span style="color: #0000BB">udm_load_ispell_data</span><span style="color: #007700">(</span><span style="color: #0000BB">$udm</span><span style="color: #007700">, </span><span style="color: #0000BB">UDM_ISPELL_TYPE_AFFIX</span><span style="color: #007700">, </span><span style="color: #DD0000">'ru'</span><span style="color: #007700">, </span><span style="color: #DD0000">'/opt/ispell/ru.aff'</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">)) ||<br /> (! </span><span style="color: #0000BB">udm_load_ispell_data</span><span style="color: #007700">(</span><span style="color: #0000BB">$udm</span><span style="color: #007700">, </span><span style="color: #0000BB">UDM_ISPELL_TYPE_SPELL</span><span style="color: #007700">, </span><span style="color: #DD0000">'en'</span><span style="color: #007700">, </span><span style="color: #DD0000">'/opt/ispell/en.dict'</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">)) ||<br /> (! </span><span style="color: #0000BB">udm_load_ispell_data</span><span style="color: #007700">(</span><span style="color: #0000BB">$udm</span><span style="color: #007700">, </span><span style="color: #0000BB">UDM_ISPELL_TYPE_SPELL</span><span style="color: #007700">, </span><span style="color: #DD0000">'ru'</span><span style="color: #007700">, </span><span style="color: #DD0000">'/opt/ispell/ru.dict'</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">))) {<br /> exit;<br />}<br /></span><span style="color: #0000BB">?></span></span></code></div> </div> </div> </p> <blockquote><p><b class="note">Note</b>: <i><tt class="parameter">flag</tt></i> is equal to <i>1</i> only in the last call. <br /> </p></blockquote> </li> <li class="listitem"> <p class="para"> UDM_ISPELL_TYPE_SPELL - indicates that ispell data should be loaded from file and initiates loading of ispell dictionary file. In this case <i><tt class="parameter">val1</tt></i> defines double letter language code for which affixes are loaded, and <i><tt class="parameter">val2</tt></i> - file path. Please note, that if a relative path entered, the module looks for the file not in UDM_CONF_DIR, but in relation to current path, i.e. to the path where the script is executed. In case of error in this mode, e.g. if file is absent, the function will return <b><tt>FALSE</tt></b>, and an error message will be displayed. Error message text cannot be accessed through <a href="function.udm-error.html" class="function">udm_error()</a> and <a href="function.udm-errno.html" class="function">udm_errno()</a>, since those functions can only return messages associated with SQL. Please, see <i><tt class="parameter">flag</tt></i> parameter description in UDM_ISPELL_TYPE_DB. </p> <div class="informalexample">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -