2014-01-22 22 views
0

這裏是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> 

而且這裏是檢查是假設來完成。

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; 
} 
?> 

我希望每一個我有我的拼寫錯了,它已經在其上強調時間具有相同的功能,就像在谷歌。我怎樣才能做到這一點?

+0

'levenshtein'是你的答案 –

+0

PHP是在服務器端...檢查您的_generated_ HTML,看看發生了什麼事情。 – Passerby

回答