PHP Conference Japan 2024

enchant_dict_add

(PHP 8)

enchant_dict_add將單字加入個人單字列表

說明

enchant_dict_add(EnchantDictionary $dictionary, string $word): void

將單字加入指定字典的個人單字列表。

參數

dictionary

enchant_broker_request_dict()enchant_broker_request_pwl_dict() 傳回的 Enchant 字典。

word

要加入的單字

傳回值

成功時傳回 true,失敗時傳回 false

更新日誌

版本 說明
8.0.0 dictionary 參數現在需要一個 EnchantDictionary 實例;先前需要的是 資源

範例

範例 #1 新增單字到 PWL

<?php

$filename
= './my_word_list.pwl';
$word = 'Supercalifragilisticexpialidocious';

$broker = enchant_broker_init();
$dict = enchant_broker_request_pwl_dict($broker, $filename);

enchant_dict_add($dict, $word);

enchant_broker_free($broker);

?>

參見

新增註記

使用者提供的註記

此頁面沒有使用者提供的註記。
To Top