本文整理匯總了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';
}
示例2: actionInsert
public function actionInsert()
{
$news = new News();
$news->title = 'BMW';
$news->short_content = "tyuning bmw is very beautiful";
$news->Insert();
var_dump($news);
}
示例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();