我正在嘗試附魔法術庫。PHP,附魔庫,如何選擇字典(如aspell或myspell)
我有一個腳本,工作正常,但我能幾本詞典(或安博泰的Myspell)
所以當我嘗試這個功能enchant_broker_set_dict_path之間進行選擇,但它似乎沒有任何效果。 而這個函數不在phpdoc中,爲什麼?
試圖在Linux上,用PHP 5.3
這裏是我的腳本
$words=array('test', 'test');
$suggestions = array();
$enchant = enchant_broker_init();
if (enchant_broker_dict_exists($enchant, $lang)) {
$dict = enchant_broker_request_dict($enchant, $lang);
foreach ($words as $word) {
$correct = enchant_dict_check($dict, $word);
if (!$correct) {
$suggs = enchant_dict_suggest($dict, $word);
if (!is_array($suggs)) {
$suggs = array();
}
$suggestions[$word] = $suggs;
}
}
enchant_broker_free_dict($dict);
enchant_broker_free($enchant);
} else {
enchant_broker_free($enchant);
throw new Exception("Could not find dictionary. Code: " . $lang);
}