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


PHP Mysql::init方法代码示例

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


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

示例1: __construct

 /**
  * Constructor
  * @param int | dbPrimaryKey , if not, param = false
  * @param string | dbConfig , if emptu = "default"
  */
 public function __construct($dbPrimaryKey = false, $dbConfigName = "default")
 {
     self::$db = Mysql::init($dbPrimaryKey, $dbConfigName);
     self::$db->setCharset("UTF8");
     if ($dbPrimaryKey) {
         if ($tmpRow = $this->fetchRow($dbPrimaryKey)) {
             foreach ($tmpRow as $key => $value) {
                 // $this->attributes[$key] = $value;
                 $this->{$key} = $value;
             }
         } else {
             foreach ($this->fields as $key => $value) {
                 // $this->attributes[$key] = false;
                 $this->{$key} = false;
             }
         }
     }
 }
开发者ID:dalinhuang,项目名称:51mook,代码行数:23,代码来源:ORM.php

示例2: init

 /**
  * Instance creator.
  *
  * @param  string $vendor
  * @return Application\Database\Vendor\{Mysql, Couch, Mongo}
  * @throws \Exception
  */
 public static final function init(string $vendor)
 {
     if (isset(self::$instances[$vendor])) {
         return self::$instances[$vendor];
     }
     $app = app();
     $cfg = $app->config->get('db');
     if (!isset($cfg[$vendor][$app->env])) {
         throw new \Exception("`{$vendor}` options not found in config!");
     }
     switch ($vendor) {
         // only mysql for now
         case self::VENDOR_MYSQL:
             self::$instances[$vendor] = Mysql::init($cfg[$vendor][$app->env]);
             break;
         default:
             throw new \Exception('Unimplemented vendor given!');
     }
     return self::$instances[$vendor];
 }
开发者ID:froq,项目名称:froq-beta-archive,代码行数:27,代码来源:Database.php

示例3: init

 /**
  * Init.
  * @param  string $vendor
  * @return Froq\Database\Vendor\VendorInterface
  */
 public static final function init(string $vendor) : VendorInterface
 {
     if (!isset(self::$instances[$vendor])) {
         $app = app();
         $appEnv = $app->env;
         $appConfig = $app->config;
         $cfg = $appConfig['db'];
         if (!isset($cfg[$vendor][$appEnv])) {
             throw new DatabaseException("'{$vendor}' options not found for '{$appEnv}' env in config!");
         }
         switch ($vendor) {
             // only mysql for now
             case self::VENDOR_MYSQL:
                 self::$instances[$vendor] = Mysql::init($cfg[$vendor][$appEnv]);
                 break;
             default:
                 throw new DatabaseException('Unimplemented vendor given!');
         }
     }
     return self::$instances[$vendor];
 }
开发者ID:froq,项目名称:froq-database,代码行数:26,代码来源:Database.php

示例4: set_log

function set_log($message, $type)
{
    $DB = Mysql::init();
    $data = array('id' => null, 'type' => $type, 'user_id' => isset($_SESSION['user_data']['id']) ? $_SESSION['user_data']['id'] : 0, 'message' => $DB->escape($message), 'date' => date('Y-m-d H:i:s'));
    return $DB->insert(ACCOUNT_DATABASE . '.site_logs', $data);
}
开发者ID:ionutmilica,项目名称:my-archive,代码行数:6,代码来源:functions.php

示例5:

<?php

$CFG->load('database');
$DB = Mysql::init($CFG->get('mysql_host'), $CFG->get('mysql_user'), $CFG->get('mysql_password'), $CFG->get('mysql_database'));
$DB->set_names();
Registry::init()->set('DB', $DB);
$CFG->unload('database');
开发者ID:ionutmilica,项目名称:my-archive,代码行数:7,代码来源:database.php

示例6: exit

<?php

if (!defined('BASEPATH')) {
    exit('Nu poti accesa acest fisier direct.');
}
set_title(site_name() . ' - Parola depozit');
$DB = Mysql::init();
check_login();
$step = 'request';
if (isset($_POST['sendStoragePassword'])) {
    $data = $DB->select("id, login, email", ACCOUNT_DATABASE . ".account", "`id`='" . $_SESSION['user_data']['id'] . "'");
    if (is_array($data)) {
        $storage_pass = $DB->select('password', PLAYER_DATABASE . '.safebox', "`account_id`='" . $_SESSION['user_data']['id'] . "'");
        if ($storage_pass == '') {
            $step = 'error';
        } else {
            // trimitem email
            $arr = array('login' => $data['login'], 'password' => $storage_pass['password'], 'site_name' => site_name(), 'site_url' => site_url());
            $email_ses = email()->load('passwordlost/storagepassword');
            $email_ses->assign($arr);
            $email_ses->set('noreply@' . rtrim(site_name(), '/'), '', $data['email'], 'Metin2 - Parola Depozit');
            $email_ses->send();
            $step = 'sent';
        }
    }
}
assign('content_tpl', 'content/storagepassword/' . $step);
开发者ID:ionutmilica,项目名称:my-archive,代码行数:27,代码来源:storagepassword.php

示例7: connection

 public function connection()
 {
     return Mysql::init();
 }
开发者ID:nikis,项目名称:Go,代码行数:4,代码来源:index.php


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