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


PHP Config::db方法代码示例

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


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

示例1: send

 public function send()
 {
     if (Config::db('profiling')) {
         $profile = View::create('profile', array('profile' => DB::profile()))->render();
         $this->output = preg_replace('#</body>#', $profile . '</body>', $this->output);
     }
     return parent::send();
 }
开发者ID:anchorcms,项目名称:anchor-cms,代码行数:8,代码来源:response.php

示例2: __construct

 function __construct()
 {
     $config = Config::db();
     $this->host = $config['host'];
     $this->database = $config['database'];
     $this->username = $config['username'];
     $this->password = $config['password'];
 }
开发者ID:arjayads,项目名称:php-simple-auth,代码行数:8,代码来源:Database.php

示例3: getDb

 public static function getDb()
 {
     if (self::$db == null) {
         $dbName = PREFIX;
         $mongo = new Mongo();
         self::$db = $mongo->{$dbName};
     }
     return self::$db;
 }
开发者ID:nervetattoo,项目名称:rutetid,代码行数:9,代码来源:Config.php

示例4: table

 public static function table($name = null)
 {
     if (is_null(static::$prefix)) {
         static::$prefix = Config::db('prefix', '');
     }
     if (!is_null($name)) {
         return static::$prefix . $name;
     }
     return static::$prefix . static::$table;
 }
开发者ID:biggtfish,项目名称:anchor-cms,代码行数:10,代码来源:base.php

示例5: getDB

 /**
     Returns the memoized database connection or creates a new one..
 */
 public static function getDB()
 {
     if (self::$db === null) {
         $config = self::$config['database'];
         $db = new mysqli($config['server'], $config['user'], $config['pass'], $config['db']);
         $db->set_charset('utf8');
         self::$db = $db;
     }
     return self::$db;
 }
开发者ID:ThomasK81,项目名称:TranscriptionDesk,代码行数:13,代码来源:config_example.php

示例6: actionIndex

 public function actionIndex()
 {
     if (Yii::app()->user->isGuest) {
         $this->redirect(Yii::app()->homeUrl);
     }
     $this->pageTitle = Yii::t('title', 'Character list');
     $criteria = new CDbCriteria();
     $criteria->select = 'name, account_id, account_name, exp, race, player_class, creation_date';
     $criteria->join = 'INNER JOIN ' . Config::db('db') . '.log_referals ON (log_referals.slave_id = t.account_id AND log_referals.master_id = "' . Yii::app()->user->id . '" AND status = "unpaid")';
     $referals = Players::model()->findAll($criteria);
     $form = new LogReferals();
     if (isset($_POST['LogReferals'])) {
         $form->attributes = $_POST['LogReferals'];
         $check_isset = LogReferals::model()->count('master_id = ' . Yii::app()->user->id . ' AND slave_id = ' . $form->slave_id . ' AND status = "unpaid"');
         if ($check_isset != 1) {
             Yii::app()->user->setFlash('message', '<div class="flash_error">' . Yii::t('pers', 'You have no referrаls.') . '</div>');
             $this->refresh();
         }
         $master = AccountData::model()->find('id = ' . Yii::app()->user->id);
         $check_ip = AccountData::model()->count('id = ' . $form->slave_id . ' AND last_ip = "' . $master->last_ip . '"');
         if ($check_ip != 0) {
             $log = LogReferals::model()->find('master_id = ' . Yii::app()->user->id . ' AND slave_id = ' . $form->slave_id . ' AND status = "unpaid"');
             $log->status = 'blocked';
             $log->update(false);
             Yii::app()->user->setFlash('message', '<div class="flash_error">' . Yii::t('pers', 'You have no referrаls.') . '</div>');
             $this->refresh();
         }
         $criteria = new CDbCriteria();
         $criteria->select = 'exp';
         $criteria->condition = 'account_id = ' . $form->slave_id;
         $criteria->order = 'exp DESC';
         $criteria->limit = 1;
         $check_lvl = Players::model()->find($criteria);
         if (Info::lvl($check_lvl->exp) < Config::get('referal_level')) {
             Yii::app()->user->setFlash('message', '<div class="flash_error">' . Yii::t('pers', 'Less than the minimum level.') . '</div>');
             $this->refresh();
         }
         $criteria = new CDbCriteria();
         $criteria->condition = 'id = ' . Yii::app()->user->id;
         $money = AccountData::model()->find($criteria);
         $money[Yii::app()->params->money] = $money[Yii::app()->params->money] + Config::get('referal_bonus');
         $money->save();
         $criteria = new CDbCriteria();
         $criteria->condition = 'id = ' . $form->slave_id;
         $money = AccountData::model()->find($criteria);
         $money[Yii::app()->params->money] = $money[Yii::app()->params->money] + Config::get('referal_bonus_ref');
         $money->save();
         $log = LogReferals::model()->find('master_id = ' . Yii::app()->user->id . ' AND slave_id = ' . $form->slave_id . ' AND status = "unpaid"');
         $log->status = 'complete';
         $log->update(false);
         Yii::app()->user->setFlash('message', '<div class="flash_success">' . Yii::t('pers', 'Bonus credit applied!') . '</div>');
         $this->refresh();
     }
     $this->render('/pers', array('model' => Players::getPlayers(), 'referals' => $referals));
 }
开发者ID:noiary,项目名称:Aion-Core-v4.7.5,代码行数:55,代码来源:PersController.php

示例7: get_posts_with_tag

/**
 * Returns an array of ids for posts that have the specified tag
 *
 * @param string
 * @return array
 */
function get_posts_with_tag($tag)
{
    $tag_ext = Extend::where('key', '=', 'post_tags')->get();
    $tag_id = $tag_ext[0]->id;
    $prefix = Config::db('prefix', '');
    $posts = array();
    foreach (Query::table($prefix . 'post_meta')->where('extend', '=', $tag_id)->where('data', 'LIKE', '%' . $tag . '%')->get() as $meta) {
        $posts[] = $meta->post;
    }
    return array_unique($posts);
}
开发者ID:christhulhu,项目名称:anchor-dark,代码行数:17,代码来源:functions.php

示例8: has_table

 public function has_table($table)
 {
     $default = Config::db('default');
     $db = Config::db('connections.' . $default . '.database');
     $sql = 'SHOW TABLES FROM `' . $db . '`';
     list($result, $statement) = DB::ask($sql);
     $statement->setFetchMode(PDO::FETCH_NUM);
     $tables = array();
     foreach ($statement->fetchAll() as $row) {
         $tables[] = $row[0];
     }
     return in_array($table, $tables);
 }
开发者ID:biggtfish,项目名称:anchor-cms,代码行数:13,代码来源:migration.php

示例9: run

 public function run()
 {
     if (Yii::app()->getController()->id == 'news' && Yii::app()->getController()->action->id == 'index') {
         $criteria = new CDbCriteria();
         $criteria->select = 'name, exp, gender, race, player_class, online';
         $criteria->condition = 'exp > 100';
         $criteria->order = 'weekly_kill DESC, all_kill DESC, ap DESC, gp DESC';
         $criteria->join = 'INNER JOIN ' . Config::db('ls') . '.account_data ON (account_data.id=t.account_id AND account_data.access_level < ' . Config::get('hide_top') . ')';
         $criteria->limit = 10;
         $model = Players::model()->with('abyssRank')->findAll($criteria);
         $this->render('widgetPvp', array('model' => $model));
     }
 }
开发者ID:noiary,项目名称:Aion-Core-v4.7.5,代码行数:13,代码来源:WidgetPvp.php

示例10: actionOnline

 public function actionOnline()
 {
     $this->pageTitle = Yii::t('title', 'Players online');
     $criteria = new CDbCriteria();
     $criteria->select = 'name, account_id, exp, gender, race, player_class, world_id, show_location';
     $criteria->condition = 'online = 1';
     $criteria->order = 'exp DESC, ap DESC';
     $criteria->join = 'INNER JOIN ' . Config::db('ls') . '.account_data ON (account_data.id=t.account_id AND account_data.access_level < ' . Config::get('hide_top') . ')';
     $pages = new CPagination(Players::model()->count($criteria));
     $pages->pageSize = Config::get('page_top');
     $pages->applyLimit($criteria);
     $model = Players::model()->with('abyssRank')->findAll($criteria);
     $this->render('online', array('model' => $model, 'pages' => $pages));
 }
开发者ID:noiary,项目名称:Aion-Core-v4.7.5,代码行数:14,代码来源:TopController.php

示例11: run

 public function run()
 {
     // Binder do banco
     $this->db = new Database();
     global $db;
     $db = $this->db;
     $this->dbo = new DatabaseOld();
     global $dbo;
     $dbo = $this->dbo;
     // Binder dos configs
     $this->config = (object) array('db' => Config::db(), 'email' => Config::email());
     // Binder do request
     Request::build();
     // Binder do router
     $this->router = new Router();
 }
开发者ID:neurosoftbrasil,项目名称:adminns,代码行数:16,代码来源:App.php

示例12: addToIndex

 static function addToIndex($id)
 {
     $indexThese = array('title', 'creator', 'subject', 'publisher', 'contributor', 'identifier', 's:subtitle', 's:isbn', 's:tag');
     $prefix = Config::db('prefix', '');
     $title = Input::get('title');
     $input = Input::get('extend.metadata_wtf');
     $metadata = self::parse_wtf($input);
     if (empty($metadata['.']['title'])) {
         $metadata['.']['title'][] = $title;
     }
     $query = Query::table($prefix . 'wtfsearch')->where('post_id', '=', $id);
     $query->delete();
     foreach ($metadata['.'] as $k => $vals) {
         if (in_array($k, $indexThese)) {
             foreach ($vals as $val) {
                 $query->insert(array('post_id' => $id, 'meta_key' => $k, 'meta_value' => normalize($val)));
             }
         }
     }
     //var_dump($prefix, $metadata, $id);
     //die;
 }
开发者ID:svita-cz,项目名称:web,代码行数:22,代码来源:wtfsearch.php

示例13: get_tags_for_post

/**
 * Returns an array of unique tags that exist on post given post,
 * empty array if no tags are found.
 *
 * @return array
 */
function get_tags_for_post($post_id)
{
    $tag_ext = Extend::where('key', '=', 'post_tags')->where('type', '=', 'post')->get();
    $tag_id = $tag_ext[0]->id;
    $prefix = Config::db('prefix', '');
    $tags = array();
    $index = 0;
    $meta = Query::table($prefix . 'post_meta')->left_join('posts', 'posts.id', '=', 'post_meta.post')->where('posts.status', '=', 'published')->where('extend', '=', $tag_id)->where('post', '=', $post_id)->get();
    $post_meta = json_decode($meta[0]->data);
    if (!trim($post_meta->text) == "") {
        foreach (explode(",", $post_meta->text) as $tag_text) {
            $tags[$index] = trim($tag_text);
            $index += 1;
        }
    }
    return array_unique($tags);
}
开发者ID:anotherMe,项目名称:anchorcms-palms-theme,代码行数:23,代码来源:functions.php

示例14: Capsule

<?php

use Illuminate\Database\Capsule\Manager as Capsule;
$capsule = new Capsule();
$capsule->addConnection(\Config::db());
$capsule->setAsGlobal();
$capsule->bootEloquent();
开发者ID:hasangilak,项目名称:wp-semi-laravel,代码行数:7,代码来源:Database.php

示例15: tableName

 public function tableName()
 {
     return Config::db('db') . '.news';
 }
开发者ID:noiary,项目名称:Aion-Core-v4.7.5,代码行数:4,代码来源:News.php


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