本文整理汇总了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');
}
}