函数名称:pspell_store_replacement()
适用版本:PHP 4 >= 4.0.2, PHP 5, PHP 7
函数描述:将一个单词的拼写建议添加到拼写词典中,并指定其替换值。
用法: bool pspell_store_replacement ( int $dictionary_link , string $misspelled , string $correct )
参数:
- dictionary_link:拼写词典链接资源,通过 pspell_new() 函数获取。
- misspelled:被替换的错误拼写的单词。
- correct:正确的单词拼写,作为替换值。
返回值: 如果成功添加了拼写替换,则返回 true,否则返回 false。
示例:
// 创建一个英语拼写词典链接
$pspell_link = pspell_new("en");
// 添加拼写替换
$misspelled = "recieve";
$correct = "receive";
if (pspell_store_replacement($pspell_link, $misspelled, $correct)) {
echo "拼写替换添加成功!";
} else {
echo "拼写替换添加失败!";
}
注意事项:
- 在调用 pspell_store_replacement() 函数之前,必须先通过 pspell_new() 函数创建一个拼写词典链接资源。
- 该函数只能用于已经创建的拼写词典链接资源,无法直接用于词典文件。