本文整理汇总了PHP中str_rp函数的典型用法代码示例。如果您正苦于以下问题:PHP str_rp函数的具体用法?PHP str_rp怎么用?PHP str_rp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了str_rp函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$id = intval($_GET['id']);
$name = trim($_GET['n']);
$map['title'] = array('LIKE', '%' . str_rp($name) . '%');
$map['uid'] = $id;
$map['status'] = 1;
if (intval($_GET['cid'])) {
$map['cate_id'] = intval($_GET['cid']);
}
if (trim($_GET['type']) == 'new') {
$title['name'] = '最新开班';
$order = 'addtime DESC,sort DESC';
} else {
$title['name'] = '课程列表';
$order = 'sort DESC,read_count DESC';
}
$totalRows = $this->mod->where($map)->count();
$page = new Page($totalRows, 10);
$list = $this->mod->limit($page->firstRow . ',' . $page->listRows)->where($map)->order($order)->select();
$this->list = $list;
$this->assign('page_show', $page->show());
$this->member_seo_set($id, '课程列表');
$this->display();
}
开发者ID:noikiy,项目名称:ypx,代码行数:25,代码来源:CourseController.class.php
示例2: curdLink
public function curdLink()
{
if (IS_AJAX) {
echo '错误!';
} elseif (IS_POST) {
$id = intval($_POST['id']);
$data['title'] = str_rp(trim($_POST['title']));
$data['url'] = str_rp(trim($_POST['url']));
$data['sort'] = intval($_POST['sort']);
$data['status'] = intval($_POST['status']);
if ($id) {
$res = $this->linkMod->where(array('id' => $id))->save($data);
} else {
$res = $this->linkMod->add($data);
}
if ($res) {
$this->success('操作成功', U('index'));
} else {
$this->error('操作失败');
}
} elseif (IS_GET) {
$id = intval($_GET['id']);
$info = $this->linkMod->where(array('id' => $id))->find();
$this->assign('info', $info);
$this->display();
}
}
开发者ID:PrayerEzio,项目名称:zuoxika,代码行数:27,代码来源:LinkController.class.php
示例3: adv_edit
public function adv_edit()
{
if (IS_POST) {
$ap_id = intval($_POST['ap_id']);
if ($ap_id) {
$data = array('title' => str_rp(trim($_POST['ap_name'])), 'url' => str_rp(trim($_POST['ap_link'])), 'intro' => str_rp(trim($_POST['default_content'])), 'type' => intval($_POST['type']), 'addtime' => NOW_TIME, 'ap_width' => intval($_POST['ap_width']), 'ap_height' => intval($_POST['ap_height']), 'sort' => intval($_POST['sort']));
if (!empty($_FILES['default_pic']['name'])) {
$param = array('savePath' => 'member/' . isLogin() . '/', 'subName' => 'Banner', 'files' => $_FILES['default_pic'], 'saveName' => 'gg_' . $ap_id, 'saveExt' => '');
$up_return = upload_one($param);
if ($up_return == 'error') {
$this->error('图片上传失败');
exit;
} else {
$data['img'] = $up_return;
}
}
$this->model->where(array('id' => $ap_id, 'uid' => isLogin()))->save($data);
$this->success("操作成功", U('advposition'));
exit;
}
} else {
$id = intval($_GET['ap_id']);
$vo = $this->model->where(array('id' => $id, 'uid' => isLogin()))->find();
$this->assign('vo', $vo);
$this->display('adv_position_edit');
}
}
开发者ID:noikiy,项目名称:ypx,代码行数:27,代码来源:AdvController.class.php
示例4: create
/**
* 发起反馈
*/
public function create()
{
if (IS_POST) {
$data['seller_id'] = $this->mid;
$data['module'] = MODULE_NAME;
$data['content'] = str_rp(trim($_POST['content']));
$data['contact'] = str_rp(trim($_POST['contact']));
$data['addtime'] = NOW_TIME;
$data['has_reply'] = 0;
//图片上传
if (!empty($_FILES['pic']['size'])) {
$img = 'feedback_' . re_md5(NOW_TIME . nonce_str());
$param = array('savePath' => MODULE_NAME . '/feedback/', 'subName' => '', 'files' => $_FILES['pic'], 'saveName' => $img, 'saveExt' => '');
$up_return = upload_one($param);
if ($up_return == 'error') {
$this->error('图片上传失败');
exit;
} else {
$data['pic'] = $up_return;
}
}
$res = $this->model->add($data);
if ($res) {
$this->success('谢谢您的意见及建议.', U('detail', array('id' => $res)));
} else {
$this->error('非常抱歉,您的意见及建议没有提交成功.');
}
} elseif (IS_GET) {
$this->h3_title = '发起反馈';
$this->display();
}
}
开发者ID:noikiy,项目名称:baomihua,代码行数:35,代码来源:FeedbackController.class.php
示例5: curd
public function curd()
{
if (IS_POST) {
$id = intval($_POST['exam_id']);
$data['exam_question'] = str_rp(trim($_POST['exam_question']));
$data['exam_option_a'] = str_rp(trim($_POST['exam_option_a']));
$data['exam_option_b'] = str_rp(trim($_POST['exam_option_b']));
$data['exam_option_c'] = str_rp(trim($_POST['exam_option_c']));
$data['exam_option_d'] = str_rp(trim($_POST['exam_option_d']));
$data['exam_answer'] = str_rp(trim($_POST['exam_answer']));
$data['exam_sort'] = intval($_POST['exam_sort']);
$data['exam_score'] = intval($_POST['exam_score']);
if ($id) {
$res = $this->model->where(array('exam_id' => $id))->save($data);
} else {
$res = $this->model->add($data);
}
if ($res) {
$this->success('操作成功', U('index'));
} else {
$this->error('操作失败');
}
} elseif (IS_GET) {
$id = intval($_GET['id']);
if ($id) {
$this->info = $this->model->where(array('exam_id' => $id))->find();
}
$this->display();
}
}
开发者ID:PrayerEzio,项目名称:zuoxika,代码行数:30,代码来源:ExamController.class.php
示例6: curdSeo
public function curdSeo()
{
if (IS_POST) {
$id = intval($_POST['id']);
$data = array('title' => str_rp(trim($_POST['title'])), 'keywords' => str_rp(trim($_POST['keywords'])), 'description' => str_rp(trim($_POST['description'])), 'cavalue' => str_rp(trim($_POST['cavalue'])), 'remark' => str_rp(trim($_POST['remark'])), 'type' => intval($_POST['type']));
if ($id) {
$res = $this->mod->where(array('id' => $id))->save($data);
if ($res) {
$this->success('更新seo成功', U('index'));
} else {
$this->error('更新seo失败');
}
} else {
$id = $this->mod->add($data);
if ($id) {
$this->success('新增seo成功', U('index'));
} else {
$this->error('新增seo失败');
}
}
} elseif (IS_GET) {
$id = intval($_GET['id']);
if ($id) {
$where = array('id' => $id);
$this->info = $this->mod->where($where)->find();
}
$this->display();
}
}
开发者ID:PrayerEzio,项目名称:zuoxika,代码行数:29,代码来源:SeoController.class.php
示例7: curd
public function curd()
{
if (IS_POST) {
$id = intval($_POST['bank_id']);
$data['bank_name'] = str_rp(trim($_POST['bank_name']));
$data['bank_tel'] = str_rp(trim($_POST['bank_tel']));
$data['bank_sort'] = intval($_POST['bank_sort']);
$data['bank_status'] = intval($_POST['bank_status']);
if ($id) {
$res = $this->model->where(array('bank_id' => $id))->save($data);
} else {
$res = $this->model->add($data);
}
if ($res) {
$this->success('操作成功', U('index'));
} else {
$this->error('操作失败');
}
} elseif (IS_GET) {
$id = intval($_GET['id']);
if ($id) {
$this->info = $this->model->where(array('bank_id' => $id))->find();
}
$this->display();
}
}
开发者ID:PrayerEzio,项目名称:zuoxika,代码行数:26,代码来源:BankController.class.php
示例8: curdStore
public function curdStore()
{
if (IS_POST) {
$id = intval($_POST['id']);
$data['store_name'] = str_rp(trim($_POST['store_name']));
$data['store_keyword'] = str_rp(trim($_POST['store_keyword']));
$data['province_id'] = intval($_POST['province_id']);
$data['city_id'] = intval($_POST['city_id']);
$data['area_id'] = intval($_POST['area_id']);
$data['store_content'] = str_replace('\'', ''', $_POST['store_content']);
$data['store_sort'] = intval($_POST['store_sort']);
$data['store_status'] = intval($_POST['store_status']);
if ($id) {
$res = $this->model->where(array('store_id' => $id))->save($data);
} else {
$res = $this->model->add($data);
}
if ($res) {
$this->success('操作成功', U('index'));
} else {
$this->error('操作失败');
}
} elseif (IS_GET) {
$where['store_id'] = intval($_GET['id']);
$info = $this->model->where($where)->find();
$this->assign('info', $info);
$this->display();
}
}
开发者ID:noikiy,项目名称:wakeup,代码行数:29,代码来源:StoreController.class.php
示例9: register
/**
* 注册
*/
public function register()
{
if (IS_POST) {
$data = array();
$smscode = trim($_POST['smscode']);
if (empty($smscode)) {
$this->error('验证码为空');
}
$data['mobile'] = str_rp(trim($_POST['mobile']));
if ($smscode == session('smscode') && session('codetype') == 'register' && session('mobile') == $data['mobile']) {
$spread = '';
$data['pwd'] = re_md5($_POST['pwd']);
$inviter = str_rp(trimall($_POST['inviter']));
if ($inviter) {
$inviter = explode('_', $inviter);
if (is_array($inviter)) {
$data['inviter_type'] = intval($inviter[0]);
$data['inviter_id'] = intval($inviter[1]);
$spread['inviter_id'] = $data['inviter_id'];
$spread['inviter_type'] = $data['inviter_type'];
$spread['invited_type'] = 1;
$spread['spread_stage'] = 0;
$spread['spread_time'] = NOW_TIME;
$spread['spread_reward'] = 2;
}
}
$data['register_time'] = NOW_TIME;
$api = 'http://int.dpool.sina.com.cn/iplookup/iplookup.php';
$ipparam['format'] = 'js';
$ipparam['ip'] = get_client_ip();
$res = get_api($api, $ipparam, 'array');
if (!empty($res['city'])) {
$data['city'] = $res['city'];
}
$seller_id = $this->model->add($data);
if ($seller_id) {
unset($data);
//推广赏金
if (is_array($spread) && !empty($spread)) {
$spread['invited_id'] = $seller_id;
M('SpreadLog')->add($spread);
}
session(null);
session('seller_id', $seller_id);
$this->success("注册成功!", U('Member/index'));
exit;
}
} else {
$this->error('验证码错误');
}
} elseif (IS_GET) {
$this->check_login();
$this->display();
}
}
开发者ID:noikiy,项目名称:baomihua,代码行数:58,代码来源:LoginController.class.php
示例10: curd
public function curd()
{
if (IS_AJAX) {
echo '错误!';
} elseif (IS_POST) {
$id = intval($_POST['article_id']);
$data['article_title'] = str_rp(trim($_POST['article_title']));
$data['ac_type'] = str_rp(trim($_POST['ac_type']));
$data['article_url'] = str_rp(trim($_POST['article_url']));
$data['seo_title'] = str_rp(trim($_POST['seo_title']));
$data['seo_key'] = str_rp(trim($_POST['seo_key']));
$data['seo_desc'] = str_rp(trim($_POST['seo_desc']));
$data['article_sort'] = intval($_POST['article_sort']);
$data['article_show'] = intval($_POST['article_show']);
$data['article_content'] = str_replace('\'', ''', $_POST['article_content']);
$data['article_time'] = NOW_TIME;
$data['to_type'] = intval($_POST['to_type']);
$arc_img = 'sa_' . $data['article_time'];
//图片上传
if ($_FILES['article_pic']['size']) {
if ($id) {
//删除图片
$article_pic = $this->model->where(array('article_id' => $id))->getField('article_pic');
if ($article_pic) {
@unlink(BasePath . '/Uploads/' . $article_pic);
}
}
$param = array('savePath' => 'artic/', 'subName' => '', 'files' => $_FILES['article_pic'], 'saveName' => $arc_img, 'saveExt' => '');
$up_return = upload_one($param);
if ($up_return == 'error') {
$this->error('图片上传失败');
exit;
} else {
$data['article_pic'] = $up_return;
}
}
if ($id) {
$res = $this->model->where(array('article_id' => $id))->save($data);
} else {
$res = $this->model->add($data);
}
if ($res) {
$this->success('操作成功', U('index'));
} else {
$this->error('操作失败');
}
} elseif (IS_GET) {
$id = intval($_GET['id']);
$info = $this->model->where(array('article_id' => $id))->find();
$this->assign('info', $info);
$this->display();
}
}
开发者ID:noikiy,项目名称:baomihua,代码行数:53,代码来源:SystemArticleController.class.php
示例11: index
public function index()
{
$where = array();
$order_sn = str_rp(trim($_GET['order_sn']));
if ($order_sn) {
$where['order_sn'] = array('like', '%' . $order_sn . '%');
}
$count = $this->reportModel->where($where)->count();
$page = new Page($count, 10);
$list = $this->reportModel->relation(true)->where($where)->limit($page->firstRow . ',' . $page->listRows)->order('addtime desc')->select();
$this->assign('list', $list);
$this->assign('page', $page->show());
$this->title = '申诉管理';
$this->assign('search', $_GET);
$this->display();
}
开发者ID:noikiy,项目名称:baomihua,代码行数:16,代码来源:ReportController.class.php
示例12: article_class_add
public function article_class_add()
{
if (IS_POST) {
$data = array();
$data['dc_upid'] = intval($_POST['ac_parent_id']);
$data['dc_title'] = str_rp(trim($_POST['dc_title']));
$data['dc_sort'] = intval($_POST['dc_sort']);
$return = $this->art_class->add($data);
if ($return) {
$this->success("操作成功", U('article_class'));
exit;
}
} else {
$this->ac_list = $this->art_class->where(array('dc_upid' => 0))->select();
$this->display('articleclass_add');
}
}
开发者ID:noikiy,项目名称:sryy,代码行数:17,代码来源:ArticleController.class.php
示例13: order_op
public function order_op()
{
$order_id = intval($_GET['order_id']);
if ($order_id) {
$data = array();
$data['shipping_name'] = str_rp(trim($_POST['shipping_name']));
$data['shipping_code'] = str_rp(trim($_POST['shipping_code']));
$data['shipping_time'] = NOW_TIME;
$data['order_state'] = 30;
$vo = $this->model->where('order_id=' . $order_id)->find();
if ($vo['order_state'] == 20) {
$this->model->where('order_id=' . $order_id)->save($data);
$this->success("操作成功", U('order'));
exit;
}
}
}
开发者ID:noikiy,项目名称:baomihua,代码行数:17,代码来源:OrderController.class.php
示例14: course
public function course()
{
$this->seo_set('培训课程');
if (!empty($_GET['name'])) {
$where['title'] = array('LIKE', '%' . str_rp(trim($_GET['name'])) . '%');
}
$where['status'] = 1;
$totalRows = D('CourseView')->where($where)->count();
$page = new Page($totalRows, 10);
$page->setConfig('prev', '上一页');
$page->setConfig('next', '下一页');
$page->setConfig('first', '首页');
$page->setConfig('last', '尾页');
$this->list = D('CourseView')->limit($page->firstRow . ',' . $page->listRows)->where($where)->order('asort DESC,addtime DESC')->select();
$this->assign('page_show', $page->show());
$this->cget = $_GET;
$this->display();
}
开发者ID:noikiy,项目名称:ypx,代码行数:18,代码来源:AllController.class.php
示例15: index
/**
* 基本信息
*/
public function index()
{
if (IS_POST) {
$data['seller_id'] = $this->mid;
if (empty($data['seller_id'])) {
$this->error('请登录.');
}
$data['pf_id'] = intval($_POST['pf_id']);
$data['store_name'] = str_rp(trim($_POST['store_name']));
$data['wangwang_id'] = str_rp(trim($_POST['wangwang_id']));
$data['province_id'] = intval($_POST['province_id']);
$data['city_id'] = intval($_POST['city_id']);
$data['area_id'] = intval($_POST['area_id']);
$data['store_url'] = str_rp(trim($_POST['store_url']));
$data['status'] = 0;
if (empty($data['pf_id']) || empty($data['store_name']) || empty($data['province_id']) || empty($data['city_id']) || empty($data['area_id']) || empty($data['store_url'])) {
$this->error('请填写必填信息.');
} else {
$res = $this->accountModel->add($data);
if ($res) {
$this->success('绑定账号成功,请等待审核通过.');
} else {
$this->error('绑定账号失败,请联系客服');
}
}
} elseif (IS_GET) {
$notice = M('SystemArticle')->where(array('article_show' => 1, 'ac_type' => 'Notice'))->order('article_sort desc,article_time desc')->find();
// $aptitude = M('Aptitude')->where(array('apt_status'=>1))->order('apt_sort desc')->select();
$seller = $this->model->relation(true)->where(array('seller_id' => $this->mid, 'seller_status' => 1))->find();
if (is_array($seller['Account'])) {
foreach ($seller['Account'] as $key => $val) {
$seller['Account'][$key]['web_platform'] = M('Platform')->where(array('pf_id' => $val['pf_id']))->getField('pf_name');
}
}
$platform = M('Platform')->order('pf_sort desc')->select();
$province = M('District')->where(array('level' => 1, 'status' => 1))->order('d_sort')->select();
$this->assign('province', $province);
$this->assign('platform', $platform);
$this->assign('seller', $seller);
$this->assign('notice', $notice);
$this->h3_title = '基本信息';
$this->display();
}
}
开发者ID:noikiy,项目名称:baomihua,代码行数:47,代码来源:MemberController.class.php
示例16: member_edit
public function member_edit()
{
if (IS_POST) {
$more_address = serialize($_POST['more_address']);
$old_pwd = M('Member')->where(array('uid' => isLogin(), 'status' => 1))->getField('password');
if (empty($_POST['password'])) {
$this->error('密码不能为空');
}
if ($old_pwd == $_POST['password']) {
$password = $_POST['password'];
} else {
$password = re_md5($_POST['password']);
}
$data = array('password' => $password, 'long_name' => str_rp(trim($_POST['long_name'])), 'nickname' => str_rp(trim($_POST['nickname'])), 'contact_phone' => str_rp(trim($_POST['contact_phone'])), 'contact_name' => str_rp(trim($_POST['contact_name'])), 'school_phone' => str_rp(trim($_POST['school_phone'])), 'school_address' => str_rp(trim($_POST['school_address'])), 'more_address' => serialize($_POST['more_address']), 'qq' => str_rp(trim($_POST['qq'])), 'email' => str_rp(trim($_POST['email'])), 'fax' => str_rp(trim($_POST['fax'])), 'school_desc' => str_replace('\'', ''', $_POST['school_desc']));
unset($lastpath);
unset($up_return);
unset($filename);
if (!empty($_FILES['avatar']['size'])) {
$lastpath = M('Member')->where(array('uid' => isLogin()))->getField('avatar');
$filename = 'avatar_' . nonce_str(8, 1, 1, 1);
$param = array('savePath' => 'member/', 'subName' => isLogin(), 'exts' => '', 'files' => $_FILES['avatar'], 'saveName' => $filename, 'saveExt' => '');
$up_return = upload_one($param);
if ($up_return) {
@unlink(BasePath . '/Uploads/' . $lastpath);
$data['avatar'] = $up_return;
} else {
$this->error('上传头像失败');
}
}
$res = M('Member')->where(array('uid' => isLogin()))->save($data);
if ($res) {
$this->success('操作成功', U('member'));
} else {
$this->error('操作失败');
}
} else {
$info = M('Member')->where(array('uid' => isLogin()))->find();
$info['more_address'] = unserialize($info['more_address']);
$info['numAdd'] = count($info['more_address']);
$this->vo = $info;
$this->display();
}
}
开发者ID:noikiy,项目名称:ypx,代码行数:43,代码来源:MemberController.class.php
示例17: curdShop
public function curdShop()
{
if (IS_POST) {
$id = intval($_POST['id']);
$latlng = explode(',', $_POST['latLng']);
$data = array('store_name' => str_rp($_POST['store_name']), 'store_tel' => str_rp($_POST['store_tel']), 'store_address' => str_rp($_POST['address']), 'store_lat' => str_rp(trim($latlng[0])), 'store_lng' => str_rp(trim($latlng[1])), 'store_num' => str_rp(trim($_POST['store_num'])), 'store_status' => intval($_POST['store_status']), 'store_intro' => str_rp(trim($_POST['store_intro'])));
if ($id) {
$res = $this->ba_mod->where(array('store_id' => $id))->save($data);
} else {
$id = $this->ba_mod->add($data);
}
if ($_FILES['article_pic']['size'] > 0) {
$filename = 'store_' . $id;
$param = array('savePath' => 'store/', 'subName' => '', 'files' => $_FILES['article_pic'], 'saveName' => $filename);
$path = upload_one($param);
if ($path != 'error') {
$id = $this->ba_mod->where(array('store_id' => $id))->setField('store_pic', $path);
} else {
$this->ba_mod->where(array('store_id' => $res))->delete();
$this->error('文件上传失败');
die;
}
}
if ($id) {
$this->success('操作成功', U('shoplist'));
} else {
$this->error('操作失败');
}
} elseif (IS_GET) {
$id = intval($_GET['id']);
if ($id) {
$this->info = $this->ba_mod->where(array('store_id' => $id))->find();
}
$this->title = '添加店铺';
$this->display();
} elseif (IS_AJAX) {
$id = intval($_POST['id']);
if ($id) {
$res = $this->ba_mod->where(array('store_id' => $id))->delete();
echo $res;
}
}
}
开发者ID:noikiy,项目名称:sryy,代码行数:43,代码来源:ShopController.class.php
示例18: contact
public function contact()
{
if (IS_AJAX) {
$data = array('uid' => intval($_POST['id']), 'course_id' => intval($_POST['lid']), 'name' => str_rp(trim($_POST['name'])), 'moblie' => str_rp(trim($_POST['moblie'])), 'phone' => str_rp(trim($_POST['phone'])), 'qq' => str_rp(trim($_POST['qq'])), 'address' => str_rp(trim($_POST['address'])), 'content' => str_rp(trim($_POST['content'])), 'ip' => get_client_ip(), 'addtime' => NOW_TIME);
$res = M('Message')->add($data);
if ($res) {
echo true;
} else {
echo false;
}
} else {
self::common();
$id = intval($_GET['id']);
$title['name'] = '联系我们';
$this->title = $title;
$this->course = M('Course')->where(array('uid' => $id, 'type' => 1, 'status' => 1))->order('sort DESC')->select();
$this->member_seo_set(intval($_GET['id']), $title['name']);
$this->display();
}
}
开发者ID:noikiy,项目名称:ypx,代码行数:20,代码来源:IndexController.class.php
示例19: create
/**
* 发起新的申诉
*/
public function create()
{
if (IS_POST) {
$data['rp_class_id'] = intval($_POST['rp_class_id']);
$data['order_sn'] = str_rp(trimall($_POST['order_sn']));
$data['content'] = str_rp(trim($_POST['content']));
$data['addtime'] = NOW_TIME;
$data['seller_id'] = $this->mid;
$where['order_sn'] = $data['order_sn'];
$where['seller_id'] = $data['seller_id'];
$data['member_id'] = M('Order')->where($where)->getField('buyer_id');
$data['from_to'] = -1;
$data['handle_status'] = 0;
if ($data['member_id']) {
$map['order_sn'] = $data['order_sn'];
$map['from_to'] = -1;
$count = $this->model->where($map)->count();
if ($count) {
$this->error('您已经提交过相关申诉,请耐心等待.');
die;
}
$res = $this->model->add($data);
if ($res) {
$detail['report_id'] = $res;
$detail['content'] = '你对买家发起申诉';
$detail['addtime'] = NOW_TIME;
M('ReportDetail')->add($detail);
$this->success('申诉成功.');
} else {
$this->error('抱歉,申诉申请失败.请联系客服.');
}
} else {
$this->error('抱歉,没有相关订单信息.');
}
} elseif (IS_GET) {
$rp_class = $this->classModel->where(array('rp_class_belong' => 1))->order('rp_class_sort desc')->select();
$this->assign('rp_class', $rp_class);
$this->h3_title = '发起新的申诉';
$this->display();
}
}
开发者ID:noikiy,项目名称:baomihua,代码行数:44,代码来源:ReportController.class.php
示例20: curdBanner
public function curdBanner()
{
if (IS_AJAX) {
$id = intval($_POST['id']);
if ($id) {
$res = $this->ba_mod->where(array('id' => $id))->delete();
echo $res;
}
} elseif (IS_GET) {
$id = intval($_GET['id']);
if ($id) {
$this->info = $this->ba_mod->where(array('id' => $id))->find();
}
$this->title = 'Banner管理';
$this->display();
} elseif (IS_POST) {
$id = intval($_POST['id']);
$data = array('title' => str_rp($_POST['title']), 'url' => str_rp($_POST['url']), 'intro' => str_rp($_POST['intro']), 'type' => intval($_POST['type']), 'sort' => intval($_POST['sort']), 'status' => intval($_POST['status']));
if ($id) {
$res = $this->ba_mod->where(array('id' => $id))->save($data);
} else {
$id = $this->ba_mod->add($data);
}
if ($_FILES['article_pic']['size'] > 0) {
$param = array('savePath' => 'banner/', 'subName' => '', 'files' => $_FILES['article_pic'], 'saveName' => 'banner_' . $id, 'saveExt' => '');
$up_return = upload_one($param);
if ($up_return == 'error') {
$this->ba_mod->where(array('id' => $id))->delete();
$this->error('图片上传失败');
exit;
} else {
$res = $this->ba_mod->where(array('id' => $id))->setField('img', $up_return);
}
}
if ($res) {
$this->success('操作成功', U('bannerlist'));
} else {
$this->error('操作失败');
}
}
}
开发者ID:noikiy,项目名称:sryy,代码行数:41,代码来源:BannerController.class.php
注:本文中的str_rp函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论