本文整理汇总了PHP中SplitWord::GetFinallyResult方法的典型用法代码示例。如果您正苦于以下问题:PHP SplitWord::GetFinallyResult方法的具体用法?PHP SplitWord::GetFinallyResult怎么用?PHP SplitWord::GetFinallyResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SplitWord
的用法示例。
在下文中一共展示了SplitWord::GetFinallyResult方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$smarty->assign('use_storage', $_CFG['use_storage']);
$action = 'form';
}
/* 初始化搜索条件 */
$keywords = '';
$tag_where = '';
if (!empty($_REQUEST['keywords'])) {
/* 代码修改_START By www.68ecshop.com */
include_once 'includes/lib_splitword_www_68ecshop_com.php';
$Recordkw = str_replace(array("\\'"), array(''), trim($_REQUEST['keywords']));
$cfg_soft_lang_www_68ecshop_com = 'utf-8';
$sp_www_68ecshop_com = new SplitWord($cfg_soft_lang_www_68ecshop_com, $cfg_soft_lang_www_68ecshop_com);
$sp_www_68ecshop_com->SetSource($Recordkw, $cfg_soft_lang_www_68ecshop_com, $cfg_soft_lang_www_68ecshop_com);
$sp_www_68ecshop_com->SetResultType(1);
$sp_www_68ecshop_com->StartAnalysis(TRUE);
$word_www_68ecshop_com = $sp_www_68ecshop_com->GetFinallyResult(' ');
//echo $word_www_68ecshop_com;
$word_www_68ecshop_com = preg_replace("/[ ]{1,}/", " ", trim($word_www_68ecshop_com));
$replacef_www_68ecshop_com = explode(' ', $word_www_68ecshop_com);
$keywords = 'AND (';
$goods_ids = array();
foreach ($replacef_www_68ecshop_com as $key => $val) {
if ($key > 0 && $key < count($replacef_www_68ecshop_com) && count($replacef_www_68ecshop_com) > 1) {
$keywords .= " AND ";
}
$val = mysql_like_quote(trim($val));
$sc_dsad = $_REQUEST['sc_ds'] ? " OR goods_desc LIKE '%{$val}%'" : '';
$keywords .= "(goods_name LIKE '%{$val}%' OR goods_sn LIKE '%{$val}%' OR keywords LIKE '%{$val}%' {$sc_dsad})";
$sql = 'SELECT DISTINCT goods_id FROM ' . $ecs->table('tag') . " WHERE tag_words LIKE '%{$val}%' ";
$res = $db->query($sql);
while ($row = $db->FetchRow($res)) {
示例2: GetKeywords
/**
* 获得关键字的分词结果,并保存到数据库
*
* @access public
* @param string $keyword 关键词
* @return string
*/
function GetKeywords($keyword)
{
global $cfg_soft_lang;
$keyword = cn_substr($keyword, 50);
$row = $this->dsql->GetOne("SELECT spwords FROM `#@__search_keywords` WHERE keyword='" . addslashes($keyword) . "'; ");
if (!is_array($row)) {
if (strlen($keyword) > 7) {
$sp = new SplitWord($cfg_soft_lang, $cfg_soft_lang);
$sp->SetSource($keyword, $cfg_soft_lang, $cfg_soft_lang);
$sp->SetResultType(2);
$sp->StartAnalysis(TRUE);
$keywords = $sp->GetFinallyResult();
$idx_keywords = $sp->GetFinallyIndex();
ksort($idx_keywords);
$keywords = $keyword . ' ';
foreach ($idx_keywords as $key => $value) {
if (strlen($key) <= 3) {
continue;
}
$keywords .= ' ' . $key;
}
$keywords = preg_replace("/[ ]{1,}/", " ", $keywords);
//var_dump($idx_keywords);exit();
unset($sp);
} else {
$keywords = $keyword;
}
$inquery = "INSERT INTO `#@__search_keywords`(`keyword`,`spwords`,`count`,`result`,`lasttime`)\n VALUES ('" . addslashes($keyword) . "', '" . addslashes($keywords) . "', '1', '0', '" . time() . "'); ";
$this->dsql->ExecuteNoneQuery($inquery);
} else {
$this->dsql->ExecuteNoneQuery("UPDATE `#@__search_keywords` SET count=count+1,lasttime='" . time() . "' WHERE keyword='" . addslashes($keyword) . "'; ");
$keywords = $row['spwords'];
}
return $keywords;
}