PHP自动获取关键字问题 标题 内容: 关键字: 当keywords为空时,自动获取关键字。 各位大神,什么写? 新手求虐、、、 PHP 关键字 自动关键字 分享到: ------解决方案--------------------比如require 'pscws4.class.php'; $text = '这里是标题测试文档'; $cws = new PSCWS4('gbk'); $cws->set_dict('etc/dict.xdb'); $cws->set_rule('etc/rules.ini'); $cws->send_text($text); echo "Top words stats:\n\n"; $ret = array(); $ret = $cws->get_tops(10,'r,v,p'); echo "No.\tWord\t\tAttr\tTimes\tRank\n------------------------------------------------------\n"; $i = 1; foreach ($ret as $tmp) { printf("%02d.\t%-16s\t%s\t%d\t%.2f\n", $i++, $tmp['word'], $tmp['attr'], $tmp['times'], $tmp['weight']); } $cws->close(); Top words stats: No. Word Attr Times Rank ------------------------------------------------------ 01. 文档 n 1 4.80 02. 标题 n 1 4.76 03. 测试 vn 1 4.72