本文整理匯總了PHP中ArticleModel::add方法的典型用法代碼示例。如果您正苦於以下問題:PHP ArticleModel::add方法的具體用法?PHP ArticleModel::add怎麽用?PHP ArticleModel::add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ArticleModel
的用法示例。
在下文中一共展示了ArticleModel::add方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: insert
/**
* 文章添加插入數據庫
*/
function insert()
{
$article = new ArticleModel();
if (!!($data = $article->create())) {
if (false !== $article->add()) {
$this->assign('jumpUrl', __URL__ . '/index');
$this->success('添加文章成功');
} else {
$this->error('添加失敗' . $article->getDbError());
}
} else {
$this->error('操作失敗:數據驗證( ' . $article->getError() . ' )');
}
}
示例2: add_art
/**
* 添加文章
*/
public function add_art()
{
if (IS_POST) {
$title = trim($_POST['title']);
$classid = $_POST['classid'];
$keywords = trim($_POST['keywords']);
$description = trim($_POST['description']);
$fengmian = trim($_POST['fengmian']);
$is_tj = $_POST['is_tj'];
$content = trim($_POST['content']);
$click = trim($_POST['click']);
$uid = $_POST['uid'];
$status = $_POST['status'];
$parr = $this->getprovcity($uid);
$p_id = $parr['p_id'];
$c_id = $parr['c_id'];
if (empty($title)) {
$this->error("標題不能為空!");
exit;
}
$M = new ArticleModel();
if ($M->check_art($title)) {
$this->error("標題已經存在!");
exit;
}
if (empty($classid)) {
$this->error("請選擇分類");
exit;
}
if (!empty($fengmian)) {
$fmimg = "/Uploads/product/" . $fengmian;
}
$data = array("title" => $title, "classid" => $classid, "keywords" => $keywords, "description" => $description, "fmimg" => $fmimg, "is_tj" => $is_tj, "content" => $content, "addtime" => time(), "click" => $click, "uid" => $uid, "adduid" => $_SESSION['my_info']['a_id'], "p_id" => $p_id, "c_id" => $c_id, "status" => $status);
$rs = $M->add($data);
if ($rs) {
$this->success("操作成功!", U("Article/index"));
} else {
$this->error("操作失敗!");
}
exit;
}
parent::_initalize();
$this->assign("systemConfig", $this->systemConfig);
#文章分類
$this->assign("artlist", $this->getartclass());
#會員列表
$this->assign("ulist", $this->getumemlist());
$this->display();
}
示例3: insert
public function insert()
{
if (!IS_POST) {
$this->message2('非法操作!', __APP__ . '/Admin');
}
$article = new ArticleModel();
if ($data = $article->create()) {
if (false !== $article->add()) {
$this->message('添加成功', __URL__ . '/index');
} else {
$this->message('添加失敗:' . $article->getError(), __URL__ . '/add');
}
} else {
$this->message('添加失敗:' . $article->getError(), __URL__ . '/add');
}
}