本文整理汇总了PHP中SplitWord::getkeyword方法的典型用法代码示例。如果您正苦于以下问题:PHP SplitWord::getkeyword方法的具体用法?PHP SplitWord::getkeyword怎么用?PHP SplitWord::getkeyword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SplitWord
的用法示例。
在下文中一共展示了SplitWord::getkeyword方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function addnews_action()
{
if ($_POST['updatenews']) {
$news_base = $this->obj->DB_select_once('news_base', "`id`='" . $_POST['id'] . "'", "`newsphoto`,`s_thumb`,`datetime`");
if ($_POST['uplocadpic']) {
if ($news_base['s_thumb'] != $_POST['uplocadpic']) {
if ($news_base['s_thumb']) {
unlink_pic('../' . $news_base['s_thumb']);
unlink_pic('../' . $news_base['newsphoto']);
}
$upload = $this->upload_pic("../data/upload/news/");
if (file_exists('..' . $_POST['uplocadpic'])) {
$uplocadpic = $upload->picture('..' . $_POST['uplocadpic'], false, 1);
//同名文件已经存在了
$s_thumb = $upload->news_makeThumb($uplocadpic, 120, 120, '_S_');
$value .= "`newsphoto`='" . str_replace("../data/upload/new", "data/upload/new", $uplocadpic) . "',";
$value .= "`s_thumb`='" . str_replace("../data/upload/new", "data/upload/new", $s_thumb) . "',";
} else {
$s_thumb = $upload->news_makeThumb('..' . $_POST['uplocadpic'], 120, 120, '_S_');
$value .= "`newsphoto`='" . str_replace("/config/", "config/", $_POST['uplocadpic']) . "',";
$value .= "`s_thumb`='" . str_replace("../config/", "config/", $s_thumb) . "',";
}
}
unlink_pic('..' . $_POST['uplocadpic']);
}
$content = str_replace(array("&", "background-color:#ffffff", "background-color:#fff", "white-space:nowrap;"), array("&", '', '', ''), html_entity_decode($_POST["content"], ENT_QUOTES, "GB2312"));
$describe = @implode(",", $_POST['describe']);
$time = time();
if (empty($_POST['did'])) {
$_POST['did'] = 0;
}
$value .= "`did`='" . $_POST['did'] . "',";
$value .= "`color`='" . $_POST['color'] . "',";
$value .= "`sort`='" . $_POST['sort'] . "',";
$value .= "`nid`='" . $_POST['nid'] . "',";
$value .= "`author`='" . $_POST['author'] . "',";
$value .= "`source`='" . $_POST['source'] . "',";
$value .= "`title`='" . $_POST['title'] . "',";
$value .= "`describe`='" . $describe . "',";
$value .= "`lastupdate`='" . $time . "',";
if (!$_POST['keyword']) {
require LIB_PATH . "lib_splitword_class.php";
$sp = new SplitWord();
$keywordarr = $sp->getkeyword(strip_tags($content));
$value .= "`keyword`='" . @implode(",", $keywordarr) . "',";
} else {
$value .= "`keyword`='" . $_POST['keyword'] . "',";
}
$value .= "`description`='" . $_POST['description'] . "'";
$nbid = $this->obj->DB_update_all("news_base", $value, "`id`='" . $_POST['id'] . "'");
$row = $this->obj->DB_select_once('news_content', "`nbid`='" . $_POST['id'] . "'", "nbid");
if (is_array($row)) {
$cont = $this->obj->DB_update_all("news_content", "`content`='" . $content . "'", "`nbid`='" . $_POST['id'] . "'");
} else {
$cont = $this->obj->DB_insert_once("news_content", "`nbid`='" . $_POST['id'] . "',`content`='" . $content . "'");
}
$this->autohtml($_POST['id'], $news_base['datetime']);
isset($nbid) ? $this->ACT_layer_msg("新闻(ID:" . $_POST['id'] . ")更新成功!", 9, Url('admin_news', null, 'admin'), 2, 1) : ${$this}->ACT_layer_msg("更新失败!", 8, Url('admin_news', null, 'admin'));
}
if ($_POST['newsadd']) {
if ($_POST['uplocadpic']) {
$upload = $this->upload_pic("../data/upload/news/");
if (file_exists('..' . $_POST['uplocadpic'])) {
$uplocadpic = $upload->picture('..' . $_POST['uplocadpic'], false, 1);
$s_thumb = $upload->news_makeThumb($uplocadpic, 120, 120, '_S_');
$value .= "`newsphoto`='" . str_replace("../data/upload/new", "data/upload/new", $uplocadpic) . "',";
$value .= "`s_thumb`='" . str_replace("../data/upload/new", "data/upload/new", $s_thumb) . "',";
} else {
$s_thumb = $upload->news_makeThumb('..' . $_POST['uplocadpic'], 120, 120, '_S_');
$value .= "`newsphoto`='" . str_replace("/config/", "config/", $_POST['uplocadpic']) . "',";
$value .= "`s_thumb`='" . str_replace("../config/", "config/", $s_thumb) . "',";
}
unlink_pic('..' . $_POST['uplocadpic']);
}
$content = str_replace(array("&", "background-color:#ffffff", "background-color:#fff", "white-space:nowrap;"), array("&", '', '', ""), html_entity_decode($_POST["content"], ENT_QUOTES, "GB2312"));
$describe = @implode(",", $_POST['describe']);
$time = time();
if ($_POST['sort'] != '') {
$value .= "`sort`='" . $_POST['sort'] . "',";
} else {
$value .= "`sort`='0',";
}
if (empty($_POST['did'])) {
$_POST['did'] = 0;
}
$value .= "`did`='" . $_POST['did'] . "',";
$value .= "`color`='" . $_POST['color'] . "',";
$value .= "`nid`='" . $_POST['nid'] . "',";
$value .= "`author`='" . $_POST['author'] . "',";
$value .= "`source`='" . $_POST['source'] . "',";
$value .= "`title`='" . $_POST['title'] . "',";
$value .= "`datetime`='" . $time . "',";
$value .= "`lastupdate`='" . $time . "',";
$value .= "`describe`='" . $describe . "',";
if (!$_POST["keyword"]) {
require LIB_PATH . "lib_splitword_class.php";
$sp = new SplitWord();
$keywordarr = $sp->getkeyword(strip_tags($content));
$value .= "`keyword`='" . @implode(",", $keywordarr) . "',";
} else {
//.........这里部分代码省略.........
示例2: trim
function addnews_action()
{
//新闻添加
include "locoy_config.php";
if ($locoyinfo['locoy_online'] != 1) {
echo 4;
die;
}
if ($locoyinfo['locoy_key'] != trim($_GET['key'])) {
echo 5;
die;
}
if (!$_POST['title'] || !$_POST['content'] || !$_POST['nid']) {
echo 2;
die;
}
$row = $this->obj->DB_select_once("news_base", "`title`='" . trim($_POST['title']) . "' and `nid`='" . $_POST['nid'] . "'");
if (is_array($row)) {
echo 3;
die;
}
$content = $_POST['content'];
$value = "";
$value .= "`title`='" . trim($_POST['title']) . "',";
$value .= "`nid`='" . $_POST['nid'] . "',";
$value .= "`did`='0',";
$value .= "`author`='" . $_POST['author'] . "',";
$description = mb_substr(strip_tags(html_entity_decode($content, ENT_NOQUOTES, "GB2312")), 0, 180, "gbk");
$description = $_POST['description'] ? $_POST['description'] : $description;
$description = str_replace(array(' ', "\n", "\r", "\r\n", " "), array(''), $description);
$value .= "`description`='" . $description . "',";
$value .= "`source`='" . $_POST['source'] . "'";
if ($_POST['ctime']) {
$value .= ",`datetime`='" . strtotime($_POST['ctime']) . "'";
} else {
$value .= ",`datetime`='" . time() . "'";
}
if ($_POST['hits']) {
$value .= ",`hits`='" . trim($_POST['hits']) . "'";
} else {
$row = explode('-', $locoyinfo['locoy_rand']);
if (is_array($row)) {
$rand = rand(trim($row[0]), trim($row[1]));
} else {
$rand = !trim($row) ? 0 : $row;
}
$value .= ",`hits`='" . $rand . "'";
}
if ($_POST['sort']) {
$value .= ",`sort`='" . trim($_POST['sort']) . "'";
} else {
$row = explode('-', $locoyinfo['locoy_sort']);
if (is_array($row)) {
$rand = rand(trim($row[0]), trim($row[1]));
} else {
$rand = !trim($row) ? 0 : $row;
}
$value .= ",`sort`='" . $rand . "'";
}
if ($_POST['newsphoto']) {
$value .= ",`newsphoto`='" . trim($_POST['newsphoto']) . "'";
}
if ($_POST['s_thumb']) {
$value .= ",`s_thumb`='" . trim($_POST['s_thumb']) . "'";
}
if (!$_POST['keyword'] && $locoyinfo['locoy_keyword'] == 1) {
require LIB_PATH . "lib_splitword_class.php";
$sp = new SplitWord();
$keywordarr = $sp->getkeyword(strip_tags(html_entity_decode($content)));
$value .= ",`keyword`='" . strip_tags(@implode(",", $keywordarr)) . "'";
} elseif ($_POST['keyword']) {
$value .= ",`keyword`='" . str_replace(",", ",", $_POST['keyword']) . "'";
}
$new_base = $this->obj->DB_insert_once("news_base", $value);
$news_content = $this->obj->DB_insert_once("news_content", "`nbid`='{$new_base}',`content`='{$content}'");
if ($new_base) {
echo 1;
die;
} else {
echo 0;
die;
}
}
示例3: trim
function addnews_action()
{
include "locoy_config.php";
if ($locoyinfo['locoy_online'] != 1) {
echo 4;
die;
}
if ($locoyinfo['locoy_key'] != trim($_GET['key'])) {
echo 5;
die;
}
if (!$_POST['title'] || !$_POST['content'] || !$_POST['nid']) {
echo 2;
die;
}
$row = $this->obj->DB_select_once("news_base", "`title`='" . trim($_POST['title']) . "' and `nid`='" . $_POST['nid'] . "'");
if (is_array($row)) {
echo 3;
die;
}
$value = "";
$value .= "`title`='" . trim($_POST['title']) . "',";
$value .= "`nid`='" . $_POST['nid'] . "',";
$value .= "`author`='" . $_POST['author'] . "',";
$value .= "`description`='" . $_POST['description'] . "',";
$value .= "`source`='" . $_POST['source'] . "'";
if ($_POST['ctime']) {
$value .= ",`datetime`='" . strtotime($_POST['ctime']) . "'";
} else {
$value .= ",`datetime`='" . time() . "'";
}
if ($_POST['hits']) {
$value .= ",`hits`='" . trim($_POST['hits']) . "'";
} else {
$row = explode('-', $locoyinfo['locoy_rand']);
if (is_array($row)) {
$rand = rand(trim($row[0]), trim($row[1]));
} else {
$rand = !trim($row) ? 0 : $row;
}
$value .= ",`hits`='" . $rand . "'";
}
if ($_POST['sort']) {
$value .= ",`sort`='" . trim($_POST['sort']) . "'";
} else {
$row = explode('-', $locoyinfo['locoy_sort']);
if (is_array($row)) {
$rand = rand(trim($row[0]), trim($row[1]));
} else {
$rand = !trim($row) ? 0 : $row;
}
$value .= ",`sort`='" . $rand . "'";
}
if ($_POST['newsphoto']) {
$value .= ",`newsphoto`='" . trim($_POST['newsphoto']) . "'";
}
if ($_POST['s_thumb']) {
$value .= ",`s_thumb`='" . trim($_POST['s_thumb']) . "'";
}
$content = $_POST['content'];
if (!$_POST['keyword'] && $locoyinfo['locoy_keyword'] == 1) {
require APP_PATH . "/include/lib_splitword_class.php";
$sp = new SplitWord();
$keywordarr = $sp->getkeyword(strip_tags($content));
$value .= ",`keyword`='" . @implode(",", $keywordarr) . "'";
} elseif ($_POST['keyword']) {
$value .= ",`keyword`='" . str_replace(",", ",", $_POST['keyword']) . "'";
}
$new_base = $this->obj->DB_insert_once("news_base", $value);
$news_content = $this->obj->DB_insert_once("news_content", "`nbid`='{$new_base}',`content`='{$content}'");
if ($new_base) {
echo 1;
die;
} else {
echo 0;
die;
}
}
示例4: array
function addnews_action()
{
if ($_POST['updatenews']) {
$news_base = $this->obj->DB_select_once('news_base', "`id`='" . $_POST['id'] . "'", "`newsphoto`,`s_thumb`,`datetime`");
if ($_POST['uplocadpic']) {
if ($news_base['s_thumb'] != $_POST['uplocadpic']) {
if ($news_base['s_thumb']) {
$this->obj->unlink_pic('../' . $news_base['s_thumb']);
$this->obj->unlink_pic('../' . $news_base['newsphoto']);
}
if ($_POST['uplocadpic']) {
$_POST['uplocadpic'] = str_replace($this->config['sy_weburl'], "", $_POST['uplocadpic']);
$value .= "`newsphoto`='" . $_POST['uplocadpic'] . "',";
$value .= "`s_thumb`='" . $_POST['uplocadpic'] . "',";
}
}
}
$content = str_replace(array("&", "background-color:#ffffff", "background-color:#fff", "white-space:nowrap;"), array("&", '', '', ''), html_entity_decode($_POST["content"], ENT_QUOTES, "GB2312"));
$describe = @implode(",", $_POST['describe']);
$time = time();
if (empty($_POST['did'])) {
$_POST['did'] = 0;
}
$value .= "`did`='" . $_POST['did'] . "',";
$value .= "`color`='" . $_POST['color'] . "',";
$value .= "`sort`='" . $_POST['sort'] . "',";
$value .= "`nid`='" . $_POST['nid'] . "',";
$value .= "`author`='" . $_POST['author'] . "',";
$value .= "`source`='" . $_POST['source'] . "',";
$value .= "`title`='" . $_POST['title'] . "',";
$value .= "`describe`='" . $describe . "',";
$value .= "`lastupdate`='" . $time . "',";
if (!$_POST['keyword']) {
require APP_PATH . "/include/lib_splitword_class.php";
$sp = new SplitWord();
$keywordarr = $sp->getkeyword(strip_tags($content));
$value .= "`keyword`='" . @implode(",", $keywordarr) . "',";
} else {
$value .= "`keyword`='" . $_POST['keyword'] . "',";
}
$value .= "`description`='" . $_POST['description'] . "'";
$nbid = $this->obj->DB_update_all("news_base", $value, "`id`='" . $_POST['id'] . "'");
$row = $this->obj->DB_select_once('news_content', "`nbid`='" . $_POST['id'] . "'", "nbid");
if (is_array($row)) {
$cont = $this->obj->DB_update_all("news_content", "`content`='" . $content . "'", "`nbid`='" . $_POST['id'] . "'");
} else {
$cont = $this->obj->DB_insert_once("news_content", "`nbid`='" . $_POST['id'] . "',`content`='" . $content . "'");
}
$this->autohtml($_POST['id'], $news_base['datetime']);
$lasturl = str_replace("&", "&", $_POST['lasturl']);
isset($nbid) ? $this->obj->ACT_layer_msg("新闻(ID:" . $_POST['id'] . ")更新成功!", 9, $lasturl, 2, 1) : ${$this}->obj->ACT_layer_msg("更新失败!", 8, $lasturl);
}
if ($_POST['newsadd']) {
if ($_POST['uplocadpic']) {
$_POST['uplocadpic'] = str_replace($this->config['sy_weburl'], "", $_POST['uplocadpic']);
$value .= "`newsphoto`='" . $_POST['uplocadpic'] . "',";
$value .= "`s_thumb`='" . $_POST['uplocadpic'] . "',";
}
$content = str_replace(array("&", "background-color:#ffffff", "background-color:#fff", "white-space:nowrap;"), array("&", '', '', ""), html_entity_decode($_POST["content"], ENT_QUOTES, "GB2312"));
$describe = @implode(",", $_POST['describe']);
$time = time();
if ($_POST['sort'] != '') {
$value .= "`sort`='" . $_POST['sort'] . "',";
} else {
$value .= "`sort`='0',";
}
if (empty($_POST['did'])) {
$_POST['did'] = 0;
}
$value .= "`did`='" . $_POST['did'] . "',";
$value .= "`color`='" . $_POST['color'] . "',";
$value .= "`nid`='" . $_POST['nid'] . "',";
$value .= "`author`='" . $_POST['author'] . "',";
$value .= "`source`='" . $_POST['source'] . "',";
$value .= "`title`='" . $_POST['title'] . "',";
$value .= "`datetime`='" . $time . "',";
$value .= "`lastupdate`='" . $time . "',";
$value .= "`describe`='" . $describe . "',";
if (!$_POST["keyword"]) {
require APP_PATH . "/include/lib_splitword_class.php";
$sp = new SplitWord();
$keywordarr = $sp->getkeyword(strip_tags($content));
$value .= "`keyword`='" . @implode(",", $keywordarr) . "',";
} else {
$value .= "`keyword`='" . $_POST['keyword'] . "',";
}
$value .= "`description`='" . $_POST["description"] . "'";
$nbid = $this->obj->DB_insert_once("news_base", $value);
$cont = $this->obj->DB_insert_once("news_content", "`nbid`='{$nbid}',`content`='" . $content . "'");
$this->autohtml($nbid, $time);
$lasturl = "index.php?m=admin_news&c=news&nid=" . $_POST['nid'];
isset($cont) ? $this->obj->ACT_layer_msg("新闻(ID:" . $nbid . ")添加成功!", 9, $lasturl, 2, 1) : $this->obj->ACT_layer_msg("添加失败!", 8, $lasturl);
}
}