Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > 05cd670d8a02b2b4a0ffb1756f2e8308 > files > 10845

php-manual-zh-5.2.4-1mdv2008.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>enchant Functions</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="PHP 手册"
HREF="index.html"><LINK
REL="UP"
TITLE="函数参考"
HREF="funcref.html"><LINK
REL="PREVIOUS"
TITLE="xptr_new_context"
HREF="function.xptr-new-context.html"><LINK
REL="NEXT"
TITLE="enchant_broker_describe"
HREF="function.enchant-broker-describe.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=UTF-8"></HEAD
><BODY
CLASS="reference"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP 手册</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.xptr-new-context.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.enchant-broker-describe.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="reference"
><A
NAME="ref.enchant"
></A
><DIV
CLASS="TITLEPAGE"
><H1
CLASS="title"
>XXXII. enchant Functions</H1
><DIV
CLASS="PARTINTRO"
><A
NAME="AEN46085"
></A
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="enchant.intro"
>简介</A
></H1
><P
>&#13;    Enchant is the PHP binding for the
    <A
HREF="http://www.abisource.com/projects/enchant/"
TARGET="_top"
>Enchant library</A
>. Enchant steps
    in to provide uniformity and conformity on top of all spelling
    libraries, and implement certain features that may be lacking in
    any individual provider library. Everything should "just work"
    for any and every definition of "just working."
   </P
><P
>&#13;    Enchat supports the following backends:
    <P
></P
><UL
><LI
><P
>&#13;       <TT
CLASS="literal"
>Aspell/Pspell (intends to replace Ispell)</TT
>
      </P
></LI
><LI
><P
>&#13;       <TT
CLASS="literal"
>Ispell (old as sin, could be interpreted as a defacto standard)</TT
>
      </P
></LI
><LI
><P
>&#13;       <TT
CLASS="literal"
>MySpell/Hunspell (an OOo projects, also used by Mozilla)</TT
>
      </P
></LI
><LI
><P
>&#13;       <TT
CLASS="literal"
>Uspell (primarily Yiddish, Hebrew, and Eastern European languages - hosted in AbiWord's CVS under the module "uspell")</TT
>
      </P
></LI
><LI
><P
>&#13;       <TT
CLASS="literal"
>Hspell (Hebrew)</TT
>
      </P
></LI
><LI
><P
>&#13;       <TT
CLASS="literal"
>AppleSpell (Mac OSX)</TT
>
      </P
></LI
></UL
>
   </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="enchant.requirements"
>需求</A
></H1
><P
>&#13;    This version uses the functions of the
    <A
HREF="http://www.abisource.com/projects/enchant/"
TARGET="_top"
>Enchant library</A
> by
    Dom Lachowicz. You need Enchant 1.2.4 or later.
   </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="enchant.installation"
>安装</A
></H1
><P
>&#13;    安装此 PECL 扩展库的信息可在手册中标题为 <A
HREF="install.pecl.html"
>PECL 扩展库安装</A
>的一章中找到。 更多信息如新版本,下载,源文件,维护者信息以及更新日志等可以在这里找到:
    <A
HREF="http://pecl.php.net/package/enchant"
TARGET="_top"
>http://pecl.php.net/package/enchant</A
>.
   </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="enchant.configuration"
>运行时配置</A
></H1
><P
>本扩展模块在 <TT
CLASS="filename"
>php.ini</TT
> 中未定义任何配置选项。</P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="enchant.resources"
>资源类型</A
></H1
><P
>&#13;    There are two types of resources in this extension. The first
    one is the broker (backends manager) and the second is for the
    dictionary.
   </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="enchant.examples"
>范例</A
></H1
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN46128"
></A
><P
><B
>例 1. Enchant Usage Example</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><code><font color="#000000">
<font color="#0000BB">&lt;?php<br />$tag </font><font color="#007700">= </font><font color="#DD0000">'en_US'</font><font color="#007700">;<br /></font><font color="#0000BB">$r </font><font color="#007700">= </font><font color="#0000BB">enchant_broker_init</font><font color="#007700">();<br /></font><font color="#0000BB">$bprovides </font><font color="#007700">= </font><font color="#0000BB">enchant_broker_describe</font><font color="#007700">(</font><font color="#0000BB">$r</font><font color="#007700">);<br />echo </font><font color="#DD0000">"Current broker provides the following backend(s):\n"</font><font color="#007700">;<br /></font><font color="#0000BB">print_r</font><font color="#007700">(</font><font color="#0000BB">$bprovides</font><font color="#007700">);<br /><br /></font><font color="#0000BB">$dicts </font><font color="#007700">= </font><font color="#0000BB">enchant_broker_list_dicts</font><font color="#007700">(</font><font color="#0000BB">$r</font><font color="#007700">);<br /></font><font color="#0000BB">print_r</font><font color="#007700">(</font><font color="#0000BB">$dicts</font><font color="#007700">);<br />if (</font><font color="#0000BB">enchant_broker_dict_exists</font><font color="#007700">(</font><font color="#0000BB">$r</font><font color="#007700">,</font><font color="#0000BB">$tag</font><font color="#007700">)) {<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$d </font><font color="#007700">= </font><font color="#0000BB">enchant_broker_request_dict</font><font color="#007700">(</font><font color="#0000BB">$r</font><font color="#007700">, </font><font color="#0000BB">$tag</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$dprovides </font><font color="#007700">= </font><font color="#0000BB">enchant_dict_describe</font><font color="#007700">(</font><font color="#0000BB">$d</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#DD0000">"dictionary $tag provides:</font><font color="#007700">\n</font><font color="#DD0000">"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$spellerrors </font><font color="#007700">= </font><font color="#0000BB">enchant_dict_check</font><font color="#007700">(</font><font color="#0000BB">$d</font><font color="#007700">, </font><font color="#DD0000">"soong"</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">print_r</font><font color="#007700">(</font><font color="#0000BB">$dprovides</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#DD0000">"found $spellerrors spell errors</font><font color="#007700">\n</font><font color="#DD0000">"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;if (</font><font color="#0000BB">$spellerrors</font><font color="#007700">) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$suggs </font><font color="#007700">= </font><font color="#0000BB">enchant_dict_suggest</font><font color="#007700">(</font><font color="#0000BB">$d</font><font color="#007700">, </font><font color="#DD0000">"soong"</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#DD0000">"Suggestions for 'soong':"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">print_r</font><font color="#007700">(</font><font color="#0000BB">$suggs</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">enchant_broker_free_dict</font><font color="#007700">(</font><font color="#0000BB">$d</font><font color="#007700">);<br />} else {<br />}<br /></font><font color="#0000BB">enchant_broker_free</font><font color="#007700">(</font><font color="#0000BB">$r</font><font color="#007700">);<br /></font><font color="#0000BB">?&gt;</font>
</font>
</code></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
></DIV
></DIV
><DIV
CLASS="TOC"
><DL
><DT
><B
>目录</B
></DT
><DT
><A
HREF="function.enchant-broker-describe.html"
>enchant_broker_describe</A
>&nbsp;--&nbsp;Enumerates the Enchant providers</DT
><DT
><A
HREF="function.enchant-broker-dict-exists.html"
>enchant_broker_dict_exists</A
>&nbsp;--&nbsp;Wether a dictionary exists or not. Using non-empty tag</DT
><DT
><A
HREF="function.enchant-broker-free-dict.html"
>enchant_broker_free_dict</A
>&nbsp;--&nbsp;Free a dictionary resource</DT
><DT
><A
HREF="function.enchant-broker-free.html"
>enchant_broker_free</A
>&nbsp;--&nbsp;Free the broker resource and its dictionnaries</DT
><DT
><A
HREF="function.enchant-broker-get-error.html"
>enchant_broker_get_error</A
>&nbsp;--&nbsp;Returns the last error of the broker</DT
><DT
><A
HREF="function.enchant-broker-init.html"
>enchant_broker_init</A
>&nbsp;--&nbsp;create a new broker object capable of requesting</DT
><DT
><A
HREF="function.enchant-broker-list-dicts.html"
>enchant_broker_list_dicts</A
>&nbsp;--&nbsp;Returns a list of available dictionaries</DT
><DT
><A
HREF="function.enchant-broker-request-dict.html"
>enchant_broker_request_dict</A
>&nbsp;--&nbsp;create a new dictionary using a tag</DT
><DT
><A
HREF="function.enchant-broker-request-pwl-dict.html"
>enchant_broker_request_pwl_dict</A
>&nbsp;--&nbsp;creates a dictionary using a PWL file. A PWL file is personal word file one word per line.</DT
><DT
><A
HREF="function.enchant-broker-set-ordering.html"
>enchant_broker_set_ordering</A
>&nbsp;--&nbsp;Declares a preference of dictionaries to use for the language</DT
><DT
><A
HREF="function.enchant-dict-add-to-personal.html"
>enchant_dict_add_to_personal</A
>&nbsp;--&nbsp;add a word to personal word list</DT
><DT
><A
HREF="function.enchant-dict-add-to-session.html"
>enchant_dict_add_to_session</A
>&nbsp;--&nbsp;add 'word' to this spell-checking session</DT
><DT
><A
HREF="function.enchant-dict-check.html"
>enchant_dict_check</A
>&nbsp;--&nbsp;Check whether a word is correctly spelled or not.</DT
><DT
><A
HREF="function.enchant-dict-describe.html"
>enchant_dict_describe</A
>&nbsp;--&nbsp;Describes an individual dictionary</DT
><DT
><A
HREF="function.enchant-dict-get-error.html"
>enchant_dict_get_error</A
>&nbsp;--&nbsp;Returns the last error of the current spelling-session</DT
><DT
><A
HREF="function.enchant-dict-is-in-session.html"
>enchant_dict_is_in_session</A
>&nbsp;--&nbsp;whether or not 'word' exists in this spelling-session</DT
><DT
><A
HREF="function.enchant-dict-quick-check.html"
>enchant_dict_quick_check</A
>&nbsp;--&nbsp;Check the word is correctly spelled and provide suggestions</DT
><DT
><A
HREF="function.enchant-dict-store-replacement.html"
>enchant_dict_store_replacement</A
>&nbsp;--&nbsp;add a correction for a word.</DT
><DT
><A
HREF="function.enchant-dict-suggest.html"
>enchant_dict_suggest</A
>&nbsp;--&nbsp;Will return a list of values if any of those pre-conditions are not met.</DT
></DL
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.xptr-new-context.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>起始页</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.enchant-broker-describe.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>xptr_new_context</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="funcref.html"
ACCESSKEY="U"
>上一级</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>enchant_broker_describe</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>