全部博文(315)
分类:
2008-01-08 15:01:28
根据版本,下载后在php.ini下
extension=php_scws.dll
scws.default.charset = gbk/utf8
然后phpinfo();你会发现有一栏scsw表示安装成功
$sh = scws_open();
scws_set_charset($sh, 'utf8');
scws_set_dict($sh, 'etc/dict.utf8.xdb');
scws_set_rule($sh, 'etc/rules.utf8.ini');
$text = "我是一个中国人陈凯歌,我会C++语言,我也有很多T恤衣服";
scws_send_text($sh, $text);
$top = scws_get_tops($sh, 5);
while ($res = scws_get_result($sh))
{
foreach ($res as $tmp)
{
if ($tmp['len'] == 1 && $tmp['word'] == "\r")
continue;
if ($tmp['len'] == 1 && $tmp['word'] == "\n")
echo $tmp['word'];
else
printf("%s/%s ", $tmp['word'], $tmp['attr']);
}
}
echo "\n\n";
scws_close($sh);