douhanxujiuji6098 2014-01-22 02:53
浏览 24
已采纳

如何将拼写检查器放入搜索引擎?

Here is the index.php

 <input type='text' size='90' name='search' onKeyPress='<?php spellcheck($search); ?>'>
 <input type='submit' name='submit' value='Search source code' ></br></br></br>

And here is where checking is suppose to be done.

checker.php

<?php
function spellcheck ( $string ) {
    $words = preg_split('/[\W]+?/',$string);
    $misspelled = $return = array();
    $int = pspell_new('en');
    foreach ($words as $value) {
        if (!pspell_check($int, $value)) {
            $misspelled[] = $value;
        }
    }
    foreach ($misspelled as $value) {
        $return[$value] = pspell_suggest($int, $value);
    }
    return $return;
}
?>

I want to have the same function like in google every time i have my spelling wrong it has underline on it. How can i do that?

  • 写回答

1条回答 默认 最新

  • dongxixian7803 2014-01-22 03:13
    关注

    This question was already asked and answered once before mate. Take a look and see if their answers are of any use to you.

    How to add spelling suggestions to PHP/SQL search script

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?