本文整理汇总了PHP中misc::getEnKeywords方法的典型用法代码示例。如果您正苦于以下问题:PHP misc::getEnKeywords方法的具体用法?PHP misc::getEnKeywords怎么用?PHP misc::getEnKeywords使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类misc
的用法示例。
在下文中一共展示了misc::getEnKeywords方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateAction
/**
* 编辑文章
* @author cms
*/
public function updateAction()
{
$data = [];
$id = intval($this->getRequest()->getQuery('id'));
$this->getView()->assign('categorys', $this->db_category->categoryList(NULL, 0, $this->db_category->get_category_count(), 'orderid', ['catid', 'catname']));
if ($this->getRequest()->isPost()) {
$news['title'] = $this->getRequest()->getPost('title');
//关键字(如果没写关键字,在标题中取。如果没取到,标题作为关键词)
$news['keywords'] = $keywords = empty($this->getRequest()->getPost('keywords', '')) ? implode(' ', misc::getKeywords($news['title'])) : $this->getRequest()->getPost('keywords', '');
$news['keywords'] = empty($news['keywords']) ? $news['title'] : $news['keywords'];
$news['catid'] = intval($this->getRequest()->getPost('catid'));
$news['description'] = $this->getRequest()->getPost('desc');
$news['attribute'] = intval($this->getRequest()->getPost('attribute'));
$news['updatetime'] = $_SERVER['REQUEST_TIME'];
$news['en_keywords'] = misc::getEnKeywords($news['keywords']);
$newdata['content'] = $this->getRequest()->getPost('content');
$this->db_document->update('news', $news, ['id' => $this->getRequest()->getPost('id')]);
$this->db_document->update('news_data', $newdata, ['id' => $this->getRequest()->getPost('id')]);
//删除前台缓存
$memkey = MEMPREFIX . 'article:detail' . $this->getRequest()->getPost('id');
$this->memcache->delete($memkey);
Alert::success('更新成功!');
$this->redirect($this->getRequest()->getPost('referer'));
exit;
} else {
$data['referer'] = isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : '/admin/document/index';
if ($news = $this->db_document->getNewsById(['id' => $id])) {
$data['news'] = $news[0];
$this->getView()->assign('data', $data);
} else {
Alert::success('此新闻不存在!');
$this->redirect($data['referer']);
exit;
}
}
}