当前位置: 首页>>代码示例>>PHP>>正文


PHP get_table_name函数代码示例

本文整理汇总了PHP中get_table_name函数的典型用法代码示例。如果您正苦于以下问题:PHP get_table_name函数的具体用法?PHP get_table_name怎么用?PHP get_table_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_table_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: add

 function add()
 {
     $model = $this->getModel();
     if (IS_POST) {
         $this->checkPostData();
         $Model = D(parse_name(get_table_name($model['id']), 1));
         // 获取模型的字段信息
         $Model = $this->checkAttr($Model, $model['id']);
         if ($Model->create() && ($id = $Model->add())) {
             $this->_saveKeyword($model, $id);
             // 清空缓存
             method_exists($Model, 'clear') && $Model->clear($id, 'edit');
             D('Scratch')->getScratchInfo($id, true);
             $this->success('添加' . $model['title'] . '成功!', U('lists?model=' . $model['name']));
         } else {
             $this->error($Model->getError());
         }
     } else {
         $fields = get_model_attribute($model['id']);
         $this->assign('fields', $fields);
         $this->meta_title = '新增' . $model['title'];
         $this->_deal_data();
         $this->display();
     }
 }
开发者ID:yxz1025,项目名称:weiphp3.0,代码行数:25,代码来源:ScratchController.class.php

示例2: edit

 public function edit($model = null, $id = 0)
 {
     is_array($model) || ($model = $this->getModel($model));
     $id || ($id = I('id'));
     if (IS_POST) {
         $Model = D(parse_name(get_table_name($model['id']), 1));
         // 清空旧关键词
         $keyword = $Model->where('id=' . $id)->getField('keyword');
         $keyword = preg_split('/[\\s,;]+/', $keyword);
         // 以空格tab逗号分号分割关键词
         $data['addon'] = 'Extensions';
         foreach ($keyword as $key) {
             $data['keyword'] = trim($key);
             $res = M('keyword')->where($data)->delete();
         }
         // 获取模型的字段信息
         $Model = $this->checkAttr($Model, $model['id']);
         if ($Model->create() && $Model->save()) {
             $this->_saveKeyword($model, $id);
             $this->success('保存' . $model['title'] . '成功!', U('lists?model=' . $model['name']));
         } else {
             $this->error($Model->getError());
         }
     } else {
         parent::edit($model, $id);
     }
 }
开发者ID:ennnnny,项目名称:weiphp3,代码行数:27,代码来源:ExtensionsController.class.php

示例3: edit

 function edit()
 {
     $cateMap['token'] = $map['token'] = get_token();
     $map['id'] = $id = I('id');
     $model = $this->getModel('wish_card_content');
     if (IS_POST) {
         $Model = D(parse_name(get_table_name($model['id']), 1));
         //读分类名称
         $cate_data['id'] = $_POST['content_cate_id'];
         $_POST['content_cate'] = M('WishCardContentCate')->where($cate_data)->getField('content_cate_name');
         // 获取模型的字段信息
         $Model = $this->checkAttr($Model, $model['id']);
         if ($Model->create() && $Model->save()) {
             $this->_saveKeyword($model, $id);
         }
         // 清空缓存
         method_exists($Model, 'clear') && $Model->clear($id, 'edit');
         $this->success('保存' . $model['title'] . '成功!', U('lists?model=' . $model['name']));
     } else {
         $cate = D('WishCardContentCate')->where($cateMap)->select();
         $data = D('WishCardContent')->find($id);
         for ($i = 0; $i < count($cate); $i++) {
             if ($cate[$i]['id'] == $data['content_cate_id']) {
                 $cate[$i]['checked'] = true;
             }
         }
         $this->assign('content_cate', $cate);
         $this->assign('data', $data);
         //dump($cate);
         $this->display(T('Addons://WishCard@WishCard/editWishContent'));
     }
 }
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:32,代码来源:WishCardContentController.class.php

示例4: edit

 function edit()
 {
     $map['id'] = $id = I('id');
     $map['token'] = get_token();
     $model = $this->getModel();
     if (IS_POST) {
         $Model = D(parse_name(get_table_name($model['id']), 1));
         // 获取模型的字段信息
         $Model = $this->checkAttr($Model, $model['id']);
         if ($Model->create() && $Model->save()) {
             $this->_saveKeyword($model, $id);
         }
         // 清空缓存
         method_exists($Model, 'clear') && $Model->clear($id, 'edit');
         $this->success('保存' . $model['title'] . '成功!', U('lists?model=' . $model['name']));
     } else {
         $normal_tips = "贺卡模板目前仅支持在贺卡插件目录下由制作人员添加";
         $this->assign('normal_tips', $normal_tips);
         $data = D('WishCard')->find($id);
         $this->assign('data', $data);
         $template = $this->_getTemplateInfo($data['template_cate'], $data['template']);
         $this->assign('template', $template);
         $this->display();
     }
 }
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:25,代码来源:WishCardController.class.php

示例5: add

 public function add()
 {
     $model = $this->model;
     $Model = D(parse_name(get_table_name($model['id']), 1));
     $shop_id = $_POST['shop_id'] = $this->shop_id;
     if (IS_POST) {
         if ($_POST['imgs'] && count($_POST['imgs']) > 0) {
             $_POST['imgs'] = implode(',', $_POST['imgs']);
         }
         // 获取模型的字段信息
         $Model = $this->checkAttr($Model, $model['id']);
         if ($Model->create() && ($id = $Model->add())) {
             D('Common/Keyword')->set($_POST['keyword'], _ADDONS, $id, $_POST['keyword_type'], 'custom_reply_news');
             $this->success('添加' . $model['title'] . '成功!', U('lists?model=' . $model['name'] . '&shop_id=' . $shop_id));
         } else {
             $this->error($Model->getError());
         }
     } else {
         $fields = get_model_attribute($model['id']);
         $extra = $this->getCateData();
         if (!empty($extra)) {
             foreach ($fields as &$vo) {
                 if ($vo['name'] == 'category_id') {
                     $vo['extra'] .= "\r\n" . $extra;
                 }
             }
         }
         $this->assign('fields', $fields);
         $this->meta_title = '新增' . $model['title'];
         $this->display();
     }
 }
开发者ID:yxz1025,项目名称:weiphp3.0,代码行数:32,代码来源:GoodsController.class.php

示例6: edit

 public function edit($id = 0)
 {
     $model = $this->getModel('credit_config');
     $id || ($id = I('id'));
     // 获取数据
     $data = M(get_table_name($model['id']))->find($id);
     $data || $this->error('数据不存在!');
     if (IS_POST) {
         $act = 'save';
         if ($data['token'] == 0) {
             $_POST['token'] = get_token();
             unset($_POST['id']);
             $act = 'add';
         }
         $Model = D(parse_name(get_table_name($model['id']), 1));
         // 获取模型的字段信息
         $Model = $this->checkAttr($Model, $model['id']);
         if ($Model->create() && $Model->{$act}()) {
             // dump($Model->getLastSql());
             $this->success('保存' . $model['title'] . '成功!', U('lists?model=' . $model['name']));
         } else {
             // dump($Model->getLastSql());
             $this->error($Model->getError());
         }
     } else {
         $fields = get_model_attribute($model['id']);
         $this->assign('fields', $fields);
         $this->assign('data', $data);
         $this->meta_title = '编辑' . $model['title'];
         $this->display('Addons/edit');
     }
 }
开发者ID:chenpusn,项目名称:guoxian,代码行数:32,代码来源:CreditController.class.php

示例7: add

    public function add()
    {
        if (IS_POST) {
            $Model = D(parse_name(get_table_name($this->model['id']), 1));
            // 获取模型的字段信息
            $Model = $this->checkAttr($Model, $this->model['id']);
            if ($Model->create() && ($id = $Model->add())) {
                $this->_saveKeyword($this->model, $id);
                // 清空缓存
                method_exists($Model, 'clear') && $Model->clear($id, 'edit');
                $param['reserve_id'] = $this->reserve_id;
                $param['model'] = $this->model['id'];
                $url = U('lists', $param);
                $this->success('添加' . $this->model['title'] . '成功!', $url);
            } else {
                $this->error($Model->getError());
            }
            exit;
        }
        $normal_tips = '字段类型为单选、多选、下拉选择的参数格式第行一项,每项的值和标题用英文冒号分开。如:<br/>0:男<br/>1:女<br/>2:保密<br/>';
        $normal_tips .= '字段类型为级联的参数格式有两种:
				<br/>一是数据源从数据库取,如: type=db&table=common_category&module=shop_category 
				<br/>二是手工输入,如: type=text&data=[广西[南宁,桂林], 广东[广州, 深圳[福田区, 龙岗区, 宝安区]]]';
        $this->assign('normal_tips', $normal_tips);
        parent::common_add($this->model);
    }
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:26,代码来源:ReserveAttributeController.class.php

示例8: edit

 function edit()
 {
     $id = $this->shop_id;
     $model = $this->getModel();
     if (IS_POST) {
         // $_POST ['update_time'] = NOW_TIME;
         $Model = D(parse_name(get_table_name($model['id']), 1));
         if ($Model->create() && $Model->save()) {
             $this->_saveKeyword($model, $id);
         }
         // 清空缓存
         method_exists($Model, 'clear') && $Model->clear($id, 'edit');
         $this->success('保存' . $model['title'] . '成功!');
     } else {
         $fields = get_model_attribute($model['id']);
         // 获取数据
         $data = D('Shop')->getInfo($id, true);
         $data || $this->error('数据不存在!');
         $token = get_token();
         if (isset($data['token']) && $token != $data['token'] && defined('ADDON_PUBLIC_PATH')) {
             $this->error('非法访问!');
         }
         $this->assign('fields', $fields);
         $this->assign('data', $data);
         $this->display();
     }
 }
开发者ID:yxz1025,项目名称:weiphp3.0,代码行数:27,代码来源:ShopController.class.php

示例9: edit

 public function edit($id = 0)
 {
     $model = $this->getModel($this->model);
     $id || ($id = I('id'));
     if (IS_POST) {
         $_POST['module'] = _ADDONS;
         $Model = D(parse_name(get_table_name($model['id']), 1));
         // 获取模型的字段信息
         $Model = $this->checkAttr($Model, $model['id']);
         if ($Model->create() && $Model->save()) {
             $this->_saveKeyword($model, $id);
             $this->success('保存' . $model['title'] . '成功!', U('lists?model=' . $model['name']));
         } else {
             $this->error($Model->getError());
         }
     } else {
         $fields = get_model_attribute($model['id']);
         // 获取数据
         $data = M(get_table_name($model['id']))->find($id);
         $data || $this->error('数据不存在!');
         $this->assign('fields', $fields);
         $this->assign('data', $data);
         $this->meta_title = '编辑' . $model['title'];
         $this->display();
     }
 }
开发者ID:noikiy,项目名称:weiphp,代码行数:26,代码来源:TemplateController.class.php

示例10: add

 public function add()
 {
     $model = $this->model;
     $Model = D(parse_name(get_table_name($model['id']), 1));
     if (IS_POST) {
         // 获取模型的字段信息
         $Model = $this->checkAttr($Model, $model['id']);
         if ($Model->create() && ($id = $Model->add())) {
             $this->_saveKeyword($model, $id, 'custom_reply_text');
             $this->success('添加' . $model['title'] . '成功!', U('lists?model=' . $model['name']));
         } else {
             $this->error($Model->getError());
         }
     } else {
         $fields = get_model_attribute($model['id']);
         $extra = $this->getCateData();
         if (!empty($extra)) {
             foreach ($fields[1] as &$vo) {
                 if ($vo['name'] == 'cate_id') {
                     $vo['extra'] .= "\r\n" . $extra;
                 }
             }
         }
         $this->assign('fields', $fields);
         $this->meta_title = '新增' . $model['title'];
         $this->display();
     }
 }
开发者ID:Backflag,项目名称:weiphp2.0.1202,代码行数:28,代码来源:CustomReplyTextController.class.php

示例11: __construct

 /**
  * Object constructor
  *
  * @param object  Instance of the rcube_db class
  * @param integer User-ID
  */
 function __construct($dbconn, $user)
 {
     $this->db = $dbconn;
     $this->db_name = get_table_name('contacts');
     $this->user_id = $user;
     $this->ready = $this->db && !$this->db->is_error();
 }
开发者ID:ehmedov,项目名称:www,代码行数:13,代码来源:rcube_contacts.php

示例12: export

 function export()
 {
     set_time_limit(0);
     // 获取模型信息
     $model = $this->model;
     // 解析列表规则
     $list_data = $this->_list_grid($model);
     $grids = $list_data['list_grids'];
     $fields = $list_data['fields'];
     foreach ($grids as $v) {
         if ($v['title'] == '操作') {
             array_pop($grids);
         } else {
             $arr = explode('|', $v['field'][0]);
             if (count($arr) > 1) {
                 $fun[$arr[0]] = $arr[1];
             }
             $ht[$arr[0]] = $v['title'];
         }
     }
     $dataArr[0] = $ht;
     // 搜索条件
     $map = $this->_search_map($model, $fields);
     $map['ask_id'] = $this->ask_id;
     $name = parse_name(get_table_name($model['id']), true);
     $data = M($name)->field(empty($fields) ? true : $fields)->where($map)->order($order)->select();
     if ($data) {
         $qdao = D('AskQuestion');
         foreach ($data as &$vv) {
             $user = get_followinfo($vv['uid']);
             $vv['nickname'] = $user['nickname'];
             $vv['times'] += 1;
             $vv['question_id'] = $qdao->getQuestionTitle($vv['question_id'], $this->ask_id);
             $vv['answer'] = implode(', ', unserialize($vv['answer']));
             $vv['is_correct'] = $vv['is_correct'] == 1 ? '是' : '否';
         }
         foreach ($data as &$vo) {
             foreach ($vo as $name => &$vv) {
                 if (isset($fun[$name])) {
                     if ($fun[$name] == 'get_name_by_status') {
                         $vv = get_name_by_status($vv, $name, $model['id']);
                     } else {
                         $vv = call_user_func($fun[$name], $vv);
                     }
                 }
             }
             foreach ($ht as $key => $val) {
                 $newArr[$key] = empty($vo[$key]) ? ' ' : $vo[$key];
             }
             $vo = $newArr;
         }
         $dataArr = array_merge($dataArr, $data);
     }
     if ($return) {
         return $dataArr;
     } else {
         outExcel($dataArr, $map['module']);
     }
 }
开发者ID:yxz1025,项目名称:weiphp3.0,代码行数:59,代码来源:AnswerController.class.php

示例13: __construct

 function __construct($dbconn, $user)
 {
     parent::__construct($dbconn, $user);
     $this->user_id = $user;
     $this->db = $dbconn;
     $this->name = 'Google Addressbook';
     $this->readonly = true;
     $this->groups = false;
     $this->undelete = false;
     $this->db_name = get_table_name('contacts_google');
 }
开发者ID:n3storm,项目名称:google_addressbook,代码行数:11,代码来源:google_addressbook_backend.php

示例14: send

 /**
  * 发布推送的信息到所有关注用户
  */
 public function send()
 {
     // $this->error ( '群发失败!错误:');
     // return;
     $togroup = I("togroup");
     //生成需要发送的数据
     is_array($model) || ($model = $this->getModel($model));
     !empty($ids) || ($ids = I('id'));
     !empty($ids) || ($ids = array_unique((array) I('ids', 0)));
     !empty($ids) || $this->error('请选择要操作的数据!');
     $Model = M(get_table_name($model['id']));
     $map['id'] = array('in', $ids);
     // 插件里的操作自动加上Token限制
     $token = get_token();
     if (defined('ADDON_PUBLIC_PATH') && !empty($token)) {
         $map['token'] = $token;
     }
     $sendlists = $Model->where($map)->order('sort asc')->select();
     if (!$sendlists) {
         $this->error('请选择要操作的数据!');
     }
     $senddata = array("articles" => array());
     foreach ($sendlists as $key => $value) {
         $senddata['articles'][] = array('thumb_media_id' => $value['thumb_media_id'], 'author' => $value['author'], 'title' => $value['title'], 'content_source_url' => $value['content_source_url'], 'content' => $value['content'], 'digest' => $value['digest'], 'show_cover_pic' => $value['show_cover_pic']);
     }
     //发送数据操作
     $mapinfo['token'] = $token;
     $info = M('member_public')->where($mapinfo)->find();
     $this->assign('info', $info);
     $options = array('token' => 'weiphp', 'appid' => $info['appid'], 'appsecret' => $info['secret']);
     $weObj = new Wechat($options);
     $accesstoken = $weObj->checkAuth($info['appid'], $info['secret']);
     $result = $weObj->uploadnews($senddata);
     if (!$result) {
         $this->error('推送信息生成失败:' . $weObj->errCode . $weObj->errmsg);
     }
     $sendmedia_id = $result['media_id'];
     if ($togroup == -1) {
     } else {
         $result = $weObj->sendall($togroup, $sendmedia_id);
         if ($result) {
             if ($result['errcode'] != 0) {
                 $this->error('群发失败!错误:' . $result['errcode'] . $result['errmsg']);
             } else {
                 $this->success('群发完成:' . $result['errmsg']);
             }
         } else {
             $this->error('群发失败!');
         }
     }
 }
开发者ID:Backflag,项目名称:weiphp2.0.1202,代码行数:54,代码来源:AbcinfosendController.class.php

示例15: db_UpdateSeriesCatalog_All

function db_UpdateSeriesCatalog_All()
{
    $result_status = array("inserted" => 0, "updated" => 0);
    $query = 'SELECT MAX(SiteID), MAX(VariableID), MAX(MethodID), MAX(SourceID), MAX(QualityControlLevelID)
            FROM ' . get_table_name('DataValues') . ' GROUP BY SiteID, VariableID, SourceID, MethodID, QualityControlLevelID';
    $result = mysql_query($query);
    if (!$result) {
        die("<p>Error in executing the SQL query " . $query . ": " . mysql_error() . "</p>");
    }
    $result_array = mysql_fetch_rowsarr($result, MYSQL_NUM);
    foreach ($result_array as $r) {
        $status = update_series_catalog($r[0], $r[1], $r[2], $r[3], $r[4]);
    }
}
开发者ID:CMIP5,项目名称:HUC8Climate,代码行数:14,代码来源:update_series_catalog.php


注:本文中的get_table_name函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。