我正在尝试附魔法术库。
我有一个运行良好的脚本,但我可以在几个字典(Aspell 或 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);
}