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


PHP News::Insert方法代碼示例

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


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

示例1: Insert

 public function Insert()
 {
     global $obj, $model;
     include_once 'Model/news.php';
     $model = new News();
     if (isset($_POST['btnSubmit'])) {
         foreach ($_POST as $key => $value) {
             try {
                 $model->{$key} = $value;
             } catch (Exception $ex) {
             }
         }
         $model->Image = $_FILES['Image']['name'];
         if ($model->Insert()) {
             if ($_FILES['Image']['name'] != "") {
                 $sp = $_FILES['Image']['tmp_name'];
                 $dp = "images/news_images/" . $model->Id . $_FILES['Image']['name'];
                 move_uploaded_file($sp, $dp);
             }
             print '<span class="success">News Created</span>';
             $model = new News();
         } else {
             print '<span class="error">' . $model->Error . '</span>';
         }
     }
     include_once 'View/News/insert.php';
 }
開發者ID:csebubt,項目名稱:news,代碼行數:27,代碼來源:newsController.php

示例2: actionInsert

 public function actionInsert()
 {
     $news = new News();
     $news->title = 'BMW';
     $news->short_content = "tyuning bmw is very beautiful";
     $news->Insert();
     var_dump($news);
 }
開發者ID:SamvelGitHub,項目名稱:phplesson1,代碼行數:8,代碼來源:AdminController.php

示例3: Date

         $news_date = "";
         $news_text = "";
         $news_user_id = "";
     }
 }
 if ($action == 2) {
     $date = new Date();
     $date->SetConverted($news_date);
     $date->ConvertToFullDate();
     $news = new News();
     $news->SetDatabase($database);
     $news->SetTitle($news_title);
     $news->SetDate($date->GetDate());
     $news->SetText($news_text);
     $news->SetUser($news_user_id);
     if ($news->Insert()) {
         $message = $screen_module_name . " incluída com sucesso.";
         $news_id = "";
         $news_title = "";
         $news_date = $date->GetNowFull();
         $news_text = "";
         $news_user_id = "";
     } else {
         $message = "Problemas na operação.";
     }
 }
 if ($action == 3) {
     $date = new Date();
     $date->SetConverted($news_date);
     $date->ConvertToFullDate();
     $news = new News();
開發者ID:googlecode-mirror,項目名稱:schifers,代碼行數:31,代碼來源:pgNew.php


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