當前位置: 首頁>>代碼示例>>PHP>>正文


PHP misc::getKeywords方法代碼示例

本文整理匯總了PHP中misc::getKeywords方法的典型用法代碼示例。如果您正苦於以下問題:PHP misc::getKeywords方法的具體用法?PHP misc::getKeywords怎麽用?PHP misc::getKeywords使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在misc的用法示例。


在下文中一共展示了misc::getKeywords方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: batchAddAction

 /**
  * 新聞批量添加
  * @author yangguofeng
  */
 public function batchAddAction()
 {
     $data = [];
     if ($_FILES['news']['name']) {
         $title = explode('.', $_FILES['news']['name']);
         $news = file_get_contents($_FILES['news']['tmp_name']);
         //新聞內容轉編碼
         $content = strcmp(mb_detect_encoding($news, ['UTF-8', 'GBK']), 'UTF-8') === 0 ? $news : mb_convert_encoding($news, "UTF-8", "GBK");
         //關鍵字(如果沒寫關鍵字,在標題中取。如果沒取到,標題作為關鍵詞)
         $keywords = empty($this->getRequest()->getPost('keywords', '')) ? implode('   ', misc::getKeywords($title[0])) : $this->getRequest()->getPost('keywords', '');
         $keywords = empty($keywords) ? $title[0] : $keywords;
         $ret = $this->topic->add("topic_data", ['title' => $title[0], 'tid' => intval($this->getRequest()->getQuery('tid')), 'sid' => intval($this->getRequest()->getQuery('sid')), 'keywords' => $keywords, 'status' => 1, 'attribute' => 0, 'userid' => $this->_user['uid'], 'username' => $data['username'] = $this->_user['username'], 'description' => mb_substr(strip_tags($content), 0, 78, 'UTF-8'), 'inputtime' => $_SERVER['REQUEST_TIME'], 'content' => $content]);
         if ($ret) {
             exit($ret);
         } else {
             header("HTTP/1.1 500 Internal Server Error");
             exit(0);
         }
     }
     $this->getView()->assign('tid', intval($this->getRequest()->getQuery('tid')));
     $this->getView()->assign('sid', intval($this->getRequest()->getQuery('sid')));
 }
開發者ID:290329416,項目名稱:guahao,代碼行數:26,代碼來源:Topicdata.php

示例2: batchAddAction

 /**
  * 新聞批量添加
  * @author cms
  */
 public function batchAddAction()
 {
     $data = [];
     $data['cid'] = $this->getRequest()->getQuery('cid');
     if ($_FILES['news']['name']) {
         //標題
         $title = explode('.', $_FILES['news']['name']);
         $data['title'] = $title[0];
         $news = file_get_contents($_FILES['news']['tmp_name']);
         //檢測新聞內容並轉編碼
         $data['content'] = strcmp(mb_detect_encoding($news, ['UTF-8', 'GBK']), 'UTF-8') === 0 ? $news : mb_convert_encoding($news, "UTF-8", "GBK");
         unset($news);
         //關鍵字(如果沒寫關鍵字,在標題中取。如果沒取到,標題作為關鍵詞)
         $data['keywords'] = empty($this->getRequest()->getPost('keywords', '')) ? implode('   ', misc::getKeywords($data['title'])) : $this->getRequest()->getPost('keywords', '');
         $data['keywords'] = empty($data['keywords']) ? $title[0] : $data['keywords'];
         $ret = $this->db_document->addNews(['title' => $data['title'], 'catid' => intval($this->getRequest()->getQuery('cid')), 'keywords' => $data['keywords'], 'url' => '', 'description' => mb_substr(strip_tags($data['content']), 0, 78, 'UTF-8'), 'inputtime' => $_SERVER['REQUEST_TIME'], 'status' => 99, 'content' => $data['content']]);
         if ($ret) {
             echo json_encode(['msg' => 'ok', 'errcode' => 200], JSON_UNESCAPED_UNICODE);
             exit('ok');
         } else {
             header("HTTP/1.1 500 Internal Server Error");
             exit(0);
         }
     }
     $this->getView()->assign('data', $data);
 }
開發者ID:290329416,項目名稱:guahao,代碼行數:30,代碼來源:Document.php


注:本文中的misc::getKeywords方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。