本文整理匯總了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;
}
}
}