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


PHP NewsModel::findOneByPk方法代碼示例

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


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

示例1: actionOne

 public function actionOne()
 {
     $id = $_GET['id'];
     $news = NewsModel::findOneByPk($id);
     $view = new View();
     $view->items = $news;
     $view->display('one.php');
 }
開發者ID:Zerotul2015,項目名稱:kemit,代碼行數:8,代碼來源:NewsController.php

示例2: actionOne

 public function actionOne()
 {
     $id = $_GET['id'];
     $item = NewsModel::findOneByPk($id);
     if (empty($item)) {
         throw new E404Exception('Нет такой новости');
     }
     $view = new View();
     $view->item = $item;
     $view->display('news/one.php');
 }
開發者ID:AcidHardcore,項目名稱:php2_6,代碼行數:11,代碼來源:NewsController.php

示例3: actionOne

 public function actionOne()
 {
     $id = $_GET['id'];
     $item = NewsModel::findOneByPk($id);
     if (!empty($item)) {
         $view = new View();
         $view->item = $item;
         $view->display('news/one.php');
     } else {
         $e_message = 'Page not found: Пустой результат выборки';
         $e_code = 1.1;
         throw new E404Exception($e_message, $e_code);
     }
 }
開發者ID:RichardSyfer,項目名稱:phplev2,代碼行數:14,代碼來源:NewsController.php

示例4: actionDelNews

 public function actionDelNews()
 {
     $news = new NewsModel();
     $view = new View();
     if (isset($_GET['id'])) {
         $item = NewsModel::findOneByPk($_GET['id']);
         $view->item = $item;
         $view->deleted = true;
         //$news->delete();
     } else {
         $newsTitles = NewsModel::findAll();
         $view->news = $newsTitles;
     }
     $view->display('admin/delnews.php');
 }
開發者ID:RichardSyfer,項目名稱:phplev2,代碼行數:15,代碼來源:AdminController.php

示例5: actionEdit

 public function actionEdit()
 {
     $news = new NewsModel();
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         $news->id = $_POST['id'];
         $news->title = $_POST['title'];
         $news->text = $_POST['text'];
         $news->save();
         header("Location: /index.php?ctrl=Admin&act=All");
     }
     $id = $_GET['id'];
     $items = $news->findOneByPk($id);
     $view = new View();
     $view->item = $items;
     $view->display('news/newsedit.php');
 }
開發者ID:aosnafanja,項目名稱:php.local,代碼行數:16,代碼來源:AdminController.php


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