必选文件:dedecms 5.6版本

includesplitword.class.php

|-data/base_dic_full.dic

|-data/words_addons.dic

调用方法:

$keywords = ‘ 同样的合法CSS居中设置在不同浏览器中的表现行为却各有千秋,下面让我们先来看一下CSS中常见的几种让元素水平居中显示的方法。’;
$sp = new SplitWord();#中文分词类
$sp->SetSource($keywords);
$sp->StartAnalysis();
print_r($sp->GetFinallyIndex());
$sp = null;

输出结果:

array(22) {
[“中”] => int(2)
[“CSS”] => int(2)
[“居中”] => int(2)
[“几种”] => int(1)
[“常见”] => int(1)
[“看一下”] => int(1)
[“先来”] => int(1)
[“水平”] => int(1)
[“方法”] => int(1)
[“显示”] => int(1)
[“我们”] => int(1)
[“元素”] => int(1)
[“却”] => int(1)
[“不同”] => int(1)
[“设置”] => int(1)
[“合法”] => int(1)
[“浏览器”] => int(1)
[“表现”] => int(1)
[“各有千秋”] => int(1)
[“同样”] => int(1)
[“行为”] => int(1)
[“下面”] => int(1)
}

- EOF -