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


PHP DB::get_one方法代码示例

本文整理汇总了PHP中DB::get_one方法的典型用法代码示例。如果您正苦于以下问题:PHP DB::get_one方法的具体用法?PHP DB::get_one怎么用?PHP DB::get_one使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DB的用法示例。


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

示例1: dogetword

 public function dogetword()
 {
     global $_M;
     $lang = $_M['form']['lang'] ? $_M['form']['lang'] : $_M['lang'];
     $word = $_M['form']['word'];
     $site = $_M['form']['site'];
     if (!file_get_contents(PATH_WEB . 'cache/lang_' . $lang . '.php')) {
         $query = "select * from {$_M['table'][language]} where lang='{$lang}' and site='{$site}' and name='{$word}'";
         $result = DB::get_one($query);
         $getword = $result['value'];
     } else {
         if ($site == 1) {
             require_once PATH_WEB . 'cache/langadmin_' . $lang . '.php';
         } else {
             require_once PATH_WEB . 'cache/lang_' . $lang . '.php';
         }
         $word = "lang_{$word}";
         $getword = ${$word};
     }
     if ($getword) {
         $back['error'] = 0;
         $back['word'] = $getword;
     } else {
         $back['error'] = 1;
     }
     jsoncallback($back);
 }
开发者ID:nanfs,项目名称:lt,代码行数:27,代码来源:getword.class.php

示例2: met_cooike_start

/**
 * 判断COOKIE是否超过一个小时,如果没有超过则更新$_M['user']['cookie']中的信息
 */
function met_cooike_start()
{
    global $_M;
    $_M['user']['cookie'] = array();
    $met_webkeys = $_M['config']['met_webkeys'];
    list($username, $password) = explode("\t", authcode($_M['form']['met_auth'], 'DECODE', $met_webkeys . $_COOKIE['met_key']));
    $username = sqlinsert($username);
    $query = "SELECT * from {$_M['table']['admin_table']} WHERE admin_id = '{$username}'";
    $user = DB::get_one($query);
    $usercooike = json_decode($user['cookie']);
    if (md5($user['admin_pass']) == $password && time() - $usercooike->time < 3600) {
        foreach ($usercooike as $key => $val) {
            $_M['user']['cookie'][$key] = $val;
        }
        if (defined('IN_ADMIN')) {
            $_M['user']['admin_name'] = get_met_cookie('metinfo_admin_name');
            $_M['user']['admin_id'] = $_M['user']['cookie']['metinfo_admin_id'];
            $privilege = background_privilege();
            $_M['user']['langok'] = $privilege['langok'];
        }
        $_M['user']['cookie']['time'] = time();
        $json = json_encode($_M['user']['cookie']);
        $query = "update {$_M['table']['admin_table']} set cookie = '{$json}' WHERE admin_id = '{$username}'";
        $user = DB::query($query);
    }
}
开发者ID:nanfs,项目名称:lt,代码行数:29,代码来源:power.func.php

示例3: news_search

function news_search($id)
{
    global $_M;
    $query = "SELECT * FROM {$_M['table']['infoprompt']} where id='{$id}'";
    $result = DB::get_one($query);
    return $result;
}
开发者ID:nanfs,项目名称:lt,代码行数:7,代码来源:news.func.php

示例4: COUNT

 /**
  * 基础统计全部数据查询语句
  * @return unknown_type
  */
 function _count()
 {
     if (!$this->_check()) {
         return false;
     }
     $result = $this->_db->get_one("SELECT COUNT(*) as total FROM " . $this->_tableName);
     return $result['total'];
 }
开发者ID:sherlockhouse,项目名称:aliyun,代码行数:12,代码来源:basedb.php

示例5: read

 public function read($sess_id)
 {
     global $user;
     // Handle the case of first time visitors and clients that don't store cookies (eg. web crawlers).
     if (!isset($_COOKIE[session_name()])) {
         $this->anonymous_user($user);
         return '';
     }
     // Query db and see user status
     $sess = $this->_db->get_one("SELECT s.`uid`, s.`lastip`, s.`data` AS session FROM `{$this->_dbtable}` s WHERE s.`sid`='%s'", $sess_id);
     if (empty($sess)) {
         $this->anonymous_user($user, isset($user->session) ? $user->session : '');
     } else {
         $user->uid = $sess['uid'];
         $user->lastip = $sess['lastip'];
         $user->session = $sess['session'];
     }
     return $user->session;
 }
开发者ID:GavinLai,项目名称:SimMatch,代码行数:19,代码来源:class.SessionDB.php

示例6: authinfo

 public function authinfo()
 {
     global $_M;
     $query = "SELECT * FROM {$_M['table']['otherinfo']} WHERE id='1'";
     $key_info = DB::get_one($query);
     $curl = load::sys_class('curl', 'new');
     $curl->set('file', "index.php?n=platform&c=authcheck&m=web&a=doauth_json&key={$key_info['authpass']}&code={$key_info['authcode']}&domain={$_M['url']['site']}&datatype=data&weblang=cn");
     $post = array('post' => '');
     $info = $curl->curl_post($post);
     $re = jsondecode($info);
     $query = "update {$_M['table']['otherinfo']} set info1='{$re['webtype_h']}' where id=1";
     DB::query($query);
     return $re;
 }
开发者ID:nanfs,项目名称:lt,代码行数:14,代码来源:auth.class.php

示例7: check_filename

 public function check_filename($filename, $id, $module)
 {
     global $_M;
     if ($filename != '') {
         if (!preg_match("/^[a-zA-Z0-9_^�-�]+\$/", $filename)) {
             $this->errorno = 'error_filename_cha';
             return false;
         }
         $query = "SELECT * FROM {$this->tablename($module)} WHERE filename='{$filename}' and lang='{$_M['lang']}'";
         $list = DB::get_one($query);
         if ($list && $list['id'] != $id) {
             $this->errorno = 'error_filename_exist';
             return false;
         }
     }
     return true;
 }
开发者ID:nanfs,项目名称:lt,代码行数:17,代码来源:module.class.php

示例8: doappdetail

 public function doappdetail()
 {
     global $_M;
     $return_this = 1;
     $appdetail['type'] = $_M['form']['type'];
     $appdetail['no'] = $_M['form']['no'];
     //$appdetail['appid'] = $_M['form']['appid'];
     if ($appdetail['type'] == 'app') {
         nav::select_nav(2);
         $getapp = load::mod_class('myapp/class/getapp', 'new');
         $app = $getapp->get_oneapp($appdetail['no']);
         if ($app) {
             $app['url'] = "<a href=\"{$app['url']}\">{$_M['word']['dlapptips5']}</a>";
         }
         $buy_Explain = $_M['word']['langshuom'];
         $buy_Explain1 = $_M['word']['purchase_application'];
         $demonstration = "<span class='demo_url'></span>";
     }
     if ($appdetail['type'] == 'tem') {
         nav::select_nav(3);
         $query = "SELECT * FROM {$_M['table']['skin_table']} WHERE skin_file ='{$appdetail['no']}'";
         $app = DB::get_one($query);
         if ($app) {
             $app['ver'] = '1.0';
             $app['url'] = "<a target=\"_blank\" href=\"{$_M['url']['adminurl']}n=theme&c=theme&a=doindex&mobile={$app['devices']}&anyid=70&lang={$_M['lang']}\">{$_M['word']['configuratio_template']}</a>";
         }
         $appdetail['no'] = $_M['form']['appid'];
         $buy_Explain = $_M['word']['template_domain'];
         $buy_Explain1 = $_M['word']['buy_template_must'];
     }
     if ($app) {
         $appdetail['download'] = 1;
     } else {
         $appdetail['download'] = 0;
     }
     $appdetail['ver'] = $app['ver'];
     $appdetail['url'] = $app['url'];
     $query = "SELECT * FROM {$_M['table']['otherinfo']} where id=1";
     $th = DB::get_one($query);
     $authkey = $th['authpass'];
     $authcode = $th['authcode'];
     require $this->template('tem/appdetail');
 }
开发者ID:nanfs,项目名称:lt,代码行数:43,代码来源:appstore.class.php

示例9: __construct

 /**
  * 初始化
  */
 public function __construct()
 {
     global $_M;
     parent::__construct();
     $this->check();
     $this->userclass = load::sys_class('user', 'new');
     $query = "SELECT * FROM {$_M['table']['column']} WHERE module='10' AND lang='{$_M['lang']}'";
     $member = DB::get_one($query);
     if ($_M['config']['met_title_type'] == 0) {
         $_M['tem_data']['title'] = $member['name'];
     } else {
         if ($_M['config']['met_title_type'] == 1) {
             $_M['tem_data']['title'] = $member['name'] . '-' . $_M['config']['met_keywords'];
         } else {
             if ($_M['config']['met_title_type'] == 2) {
                 $_M['tem_data']['title'] = $member['name'] . '-' . $_M['config']['met_webname'];
             } else {
                 if ($_M['config']['met_title_type'] == 3) {
                     $_M['tem_data']['title'] = $member['name'] . '-' . $_M['config']['met_keywords'] . '-' . $_M['config']['met_webname'];
                 }
             }
         }
     }
     $query = "SELECT * FROM {$_M['table']['ifmember_left']}";
     $navigation = DB::get_all($query);
     foreach ($navigation as $key => $val) {
         if ($val[columnid]) {
             //$column = $class_list[$val[columnid]];
             $query = "SELECT * FROM {$_M['table']['column']} WHERE id = '{$val[columnid]}'";
             $column = DB::get_one($query);
             $val['foldername'] = $val['foldername'] ? $val['foldername'] : $column['foldername'];
             $val['filename'] = $val['filename'] ? $val['filename'] : 'index.php';
             $list['url'] = "../{$val['foldername']}/{$val['filename']}";
             $list['title'] = $column['name'];
         } else {
             $list['url'] = "../{$val['foldername']}/{$val['filename']}";
             $list['title'] = $val['title'];
         }
         $_M['html']['app_sidebar'][] = $list;
     }
 }
开发者ID:nanfs,项目名称:lt,代码行数:44,代码来源:userweb.class.php

示例10: dodelapp

 public function dodelapp()
 {
     global $_M;
     $no = $_M['form']['no'];
     $getapp = load::mod_class('myapp/class/getapp', 'new');
     $app = $getapp->get_oneapp($no);
     if ($app['m_class']) {
         $uninstall = load::app_class($app['m_name'] . '/admin/uninstall', 'new');
         $uninstall->dodel();
         turnover($_M['url']['own_name'] . '&c=myapp&a=doindex', $_M['word']['physicaldelok']);
     } else {
         $query = "DELETE FROM {$_M['table']['applist']} WHERE no='{$no}'";
         DB::query($query);
         $query = "SELECT * FROM {$_M['table']['app']} WHERE no='{$no}' AND download=1";
         $app_old = DB::get_one($query);
         if (file_exists(PATH_WEB . $_M['config']['met_adminfile'] . '/app/' . $app['m_name'] . '/delapp.php')) {
             header('location:' . $_M['url']['site_admin'] . 'app/' . $app['m_name'] . '/delapp.php?lang=' . $_M['lang'] . '&id=' . $app_old['id'] . '&action=del');
         } else {
             header('location:' . $_M['url']['site_admin'] . 'app/dlapp/delapp.php?lang=' . $_M['lang'] . '&id=' . $app_old['id'] . '&action=del');
         }
     }
 }
开发者ID:nanfs,项目名称:lt,代码行数:22,代码来源:myapp.class.php

示例11: get_para

 public function get_para($listid, $module, $class1, $class2, $class3)
 {
     global $_M;
     $paralist = $this->get_para_list($module, $class1, $class2, $class3);
     foreach ($paralist as $val) {
         $para = DB::get_one("SELECT * FROM {$this->table($module)} WHERE listid='{$listid}' and paraid='{$val[id]}' and lang = '{$this->lang}'");
         if ($val['type'] == 7) {
             $para7 = explode("-", $para['info']);
             $list['info_' . $val['id'] . '_1'] = $para7[0];
             $list['info_' . $val['id'] . '_2'] = $para7[1];
             if ($para7[2]) {
                 $list['info_' . $val['id'] . '_3'] = $para7[2];
             }
         }
         $list['info_' . $val['id']] = $para['info'];
         if (!$para) {
             $infos[$val['id']] = '';
         }
     }
     if ($infos) {
         $this->insert_para($listid, $infos, $module);
     }
     return $list;
 }
开发者ID:nanfs,项目名称:lt,代码行数:24,代码来源:para.class.php

示例12: complete

 public function complete()
 {
     global $_M;
     $this->del_dl_file();
     if ($this->info['type'] == 'cms') {
         return $this->suc_data('end', 0, "{$_M['word']['installation_complete']},3{$_M['word']['seconds_background']}", 1, 'refresh');
     }
     if ($this->info['type'] == 'app') {
         $this->add_power($this->info['no']);
         $getapp = load::mod_class('myapp/class/getapp', 'new');
         $app = $getapp->get_oneapp($this->info['no']);
         $html = "<a href=\"{$app['url']}\">{$_M['word']['dlapptips5']}</a>";
         return $this->suc_data('end', 0, $html);
     }
     if ($this->info['type'] == 'tem') {
         $query = "SELECT * FROM {$_M['table']['skin_table']} ORDER BY id DESC";
         $tem = DB::get_one($query);
         $html = "<a target=\"_blank\" href=\"{$_M['url']['adminurl']}n=theme&c=theme&a=doindex&mobile={$tem['devices']}&anyid=70&lang={$_M['lang']}\">{$_M['word']['configuratio_template']}</a>";
         return $this->suc_data('end', 0, $html);
     }
 }
开发者ID:nanfs,项目名称:lt,代码行数:21,代码来源:download.class.php

示例13: get_other_user

 public function get_other_user($unionid)
 {
     $query = "SELECT * FROM {$this->table} WHERE unionid = '{$unionid}' and type='{$this->type}'";
     return DB::get_one($query);
 }
开发者ID:nanfs,项目名称:lt,代码行数:5,代码来源:other.class.php

示例14: get_product

 public function get_product($pid)
 {
     global $_M;
     $query = "SELECT * FROM {$_M['table']['shopv2_product']} WHERE pid='{$pid}'";
     $product = DB::get_one($query);
     return $product;
 }
开发者ID:nanfs,项目名称:lt,代码行数:7,代码来源:sys_shop_new.class.php

示例15: dosetsave

 public function dosetsave()
 {
     global $_M;
     $list = explode(",", $_M[form][allid]);
     $type = $_M[form][submit_type];
     $i = 0;
     foreach ($list as $id) {
         if ($id) {
             $i++;
             if ($type == 'save' || !$type) {
                 $name = $_M['form']['name-' . $id];
                 $defaultvalue = $_M['form']['defaultvalue-' . $id];
                 $valueinfo = $_M['form']['valueinfo-' . $id];
                 $type1 = $_M['form']['type-' . $id];
                 $tips = $_M['form']['tips-' . $id];
                 $selectd = $_M['form']['selectd-' . $id];
                 $style = $_M['form']['style-' . $id];
                 $no = $_M['form']['no'];
                 $pos = $_M['form']['pos-' . $id];
                 $no_order = $i;
                 if ($pos != $_M['form']['pos']) {
                     $counter = DB::counter($_M['table']['templates'], " WHERE no='{$_M['form']['no']}' and pos='{$pos}'  and lang='{$_M['form']['lang']}'", '*');
                     $no_order = $no_order + $counter;
                 }
                 $query = "\n\t\t\t\t\t\tno           = '{$no}',\n\t\t\t\t\t\tpos          = '{$pos}',\n\t\t\t\t\t\tno_order     = '{$no_order}',\n\t\t\t\t\t\tname         = '{$name}',\n\t\t\t\t\t\tdefaultvalue = '{$defaultvalue}',\n\t\t\t\t\t\tvalueinfo    = '{$valueinfo}',\n\t\t\t\t\t\ttype\t     = '{$type1}',\n\t\t\t\t\t\ttips\t     = '{$tips}',\n\t\t\t\t\t\tselectd\t     = '{$selectd}',\n\t\t\t\t\t\tstyle\t     = '{$style}',\n\t\t\t\t\t\tlang         = '{$_M['form']['lang']}'\n\t\t\t\t\t";
                 if (is_number($id)) {
                     //修改
                     $query = "UPDATE {$_M['table']['templates']} SET {$query} WHERE id = '{$id}' ";
                 } else {
                     //新增
                     $query = "INSERT INTO {$_M['table']['templates']} SET value = '{$defaultvalue}', {$query} ";
                 }
             } elseif ($type == 'del') {
                 //删除
                 if (is_number($id)) {
                     $query = "DELETE FROM {$_M['table']['templates']} WHERE id='{$id}' and pos = '{$_M['form']['pos']}' and lang='{$_M['form']['lang']}' ";
                 }
             }
             DB::query($query);
         }
     }
     /*同步到其它语言*/
     $query = "SELECT * FROM {$_M['table']['templates']} where no='{$_M['form']['no']}' AND lang='{$_M['form']['lang']}' ORDER BY no_order,id";
     $tems = DB::get_all($query);
     foreach ($_M['langlist']['web'] as $key => $val) {
         if ($key != $_M['form']['lang']) {
             $query = "DELETE FROM {$_M['table']['templates']} WHERE no='{$_M['form']['no']}' AND lang='{$key}'";
             DB::query($query);
             foreach ($tems as $keytems => $valtems) {
                 $query = "INSERT INTO {$_M['table']['templates']} SET no='{$valtems['no']}',pos ='{$valtems['pos']}',no_order='{$valtems['no_order']}',type='{$valtems['type']}',style='{$valtems['style']}',selectd='{$valtems['selectd']}',name ='{$valtems['name']}',value='{$valtems['value']}',defaultvalue='{$valtems['defaultvalue']}',valueinfo ='{$valtems['valueinfo']}',tips='{$valtems['tips']}',lang='{$key}'";
                 DB::query($query);
             }
         }
     }
     /*生成安装文件*/
     load::sys_func('file');
     $file = "templates/{$_M['form']['no']}/install/install.class.php";
     makefile($file);
     $query = "SELECT * FROM {$_M['table']['skin_table']} where skin_file='{$_M['form']['no']}'";
     $tem = DB::get_one($query);
     $query = "SELECT * FROM {$_M['table']['templates']} where no='{$_M['form']['no']}' AND lang='{$_M['form']['lang']}' ORDER BY no_order,id";
     $tems = DB::get_all($query);
     foreach ($tems as $keytems => $valtems) {
         $sql[] = "pos ='{$valtems['pos']}',no_order='{$valtems['no_order']}',type='{$valtems['type']}',style='{$valtems['style']}',selectd='{$valtems['selectd']}',name ='{$valtems['name']}',value='{$valtems['defaultvalue']}',defaultvalue='{$valtems['defaultvalue']}',valueinfo ='{$valtems['valueinfo']}',tips='{$valtems['tips']}'";
     }
     $sql_info = var_export($sql, true);
     $info .= "\n\$sql = {$sql_info};\n\$no='{$_M['form']['no']}';\n\$devices='{$tem['devices']}';";
     $str = file_get_contents(PATH_OWN_FILE . 'file/install.class.php');
     $str = str_replace('/*<!--sql-->*/', $info, $str);
     file_put_contents(PATH_WEB . $file, $str);
     turnover("{$_M[url][own_form]}a=doset&no={$_M['form']['no']}&pos={$_M['form']['pos']}", '操作成功');
 }
开发者ID:nanfs,项目名称:lt,代码行数:72,代码来源:temset.class.php


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