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


PHP config::getInstance方法代码示例

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


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

示例1: __construct

    function __construct($instanceName, $configName=null) {
        //populate the needed connection information from the config.ini file
        $this->instanceName = $instanceName;
        $config = config::getInstance($configName);
        $this->hostname = $config->get('hostname');
        $this->username = $config->get('username');
        $this->password = $config->get('password');
        $this->database = $config->get('database');
        $this->db = mysql_connect($this->hostname, $this->username, $this->password) or die("There was an error conntecting to the database:".$this->database." on server: ".$this->hostname." for user:".$this->username);

        $selectedDB = mysql_select_db($this->database, $this->db) or die("There was an error selecting the database");
    }
开发者ID:eversor1,项目名称:slaptight,代码行数:12,代码来源:db.class.php

示例2: __construct

 private function __construct()
 {
     $this->config = config::getInstance();
     $this->db = db::getInstance();
     $this->adapter = new Smarty();
     $this->adapter->template_dir = $this->config->root_dir . '/temp/templates/';
     $this->adapter->compile_dir = $this->config->root_dir . '/temp/templates_c/';
     $this->adapter->config_dir = $this->config->root_dir . '/temp/configs/';
     $this->adapter->cache_dir = $this->config->root_dir . '/temp/cache/';
     $this->adapter->debugging = $this->config->smarty_debug;
     $this->adapter->caching = TRUE;
     $this->adapter->cache_lifetime = 30;
     $this->adapter->plugins_dir = $this->config->root_dir . '/system/lib/Smarty/libs/plugins';
     $this->adapter->compile_check = TRUE;
     $this->adapter->force_compile = TRUE;
     $this->adapter->register_object('db', $this->db->adapter);
     $this->adapter->register_resource('db', array('smarty_resource_db_source', 'smarty_resource_db_timestamp', 'smarty_resource_db_secure', 'smarty_resource_db_trusted'));
     $this->adapter->register_resource('data', array('smarty_resource_data_source', 'smarty_resource_data_timestamp', 'smarty_resource_data_secure', 'smarty_resource_data_trusted'));
 }
开发者ID:jfkz,项目名称:aquarel-cms,代码行数:19,代码来源:Smarty.php

示例3: __construct

 public function __construct()
 {
     // parent::__construct();
     config::getInstance();
     config::getConfig();
     $router = new Router();
     $router->explodeUri();
     /*
     apenas para checagem dos caminhos
     //echo '<p>ROUT FILE: '.$routFile.'</p>';
     echo '<pre >';
     echo '<p>ROTA COMPLETA: '.$this->getRoute().'</p>';
     echo '<p>NOME Controller: '.$this->getController().'</p>';
     echo '<p>NOME METODO: '.$this->getAction().'</p>';
     echo '</pre>';
     */
     define('ROUTE', $router->getRoute());
     define('CONTROLLER', $router->getController());
     define('ACTION', $router->getAction());
     $filename = BASEPATH . DIRECTORY_SEPARATOR . APPPATH . DIRECTORY_SEPARATOR . CONTROLLERS . DIRECTORY_SEPARATOR . ROUTE . CONTROLLER . '.controller.php';
     if (file_exists($filename)) {
         require_once $filename;
         $_controllerName = CONTROLLER;
         $_controller = new $_controllerName();
         $action = ACTION;
         if (method_exists($_controller, $action)) {
             $_controller->{$action}();
         } else {
             require_once BASEPATH . DIRECTORY_SEPARATOR . APPPATH . DIRECTORY_SEPARATOR . CONTROLLERS . DIRECTORY_SEPARATOR . 'error404.controller.php';
             $errorController = new error404();
             $errorController->index();
         }
     } else {
         require_once BASEPATH . DIRECTORY_SEPARATOR . APPPATH . DIRECTORY_SEPARATOR . CONTROLLERS . DIRECTORY_SEPARATOR . 'error404.controller.php';
         $errorController = new error404();
         $errorController->index();
     }
 }
开发者ID:Wellingtoncezar,项目名称:pfc,代码行数:38,代码来源:index.php

示例4: sendRemote

 /**
  *
  * @send a message by remote mail server
  *
  */
 public function sendRemote()
 {
     /*** get config values for mail ***/
     $config = config::getInstance();
     /*** headers ***/
     $headers = '';
     $this->stream = fsockopen($config->config_values['mail']['smtp_server'], $config->config_values['mail']['smtp_port'], $errno, $errstr, 1);
     $res = fgets($this->stream, 256);
     if (substr($res, 0, 3) != "220") {
         echo $res . 'stream fail<br />';
     }
     // Introduce ourselves
     fputs($this->stream, 'HELO ' . $config->config_values['mail']['smtp_server'] . $this->eol);
     $res = fgets($this->stream, 256);
     if (substr($res, 0, 3) != "250") {
         echo $res . 'helo fail<br />';
     }
     // Envelope from
     fputs($this->stream, 'MAIL FROM: ' . $this->mail_from_email . $this->eol);
     $res = fgets($this->stream, 256);
     if (substr($res, 0, 3) != "250") {
         echo $res . 'mail from fail<br />';
     }
     // Envelope to
     fputs($this->stream, 'RCPT TO: ' . $this->mail_to_email . $this->eol);
     $res = fgets($this->stream, 256);
     if (substr($res, 0, 3) != "250") {
         echo $res . 'to fail<br />';
     }
     // The message
     fputs($this->stream, "DATA" . $this->eol);
     $res = fgets($this->stream, 256);
     if (substr($res, 0, 3) != "354") {
         echo $res . 'data fail';
     }
     // Send To:, From:, Subject:, other headers, blank line, message, and finish
     // with a period on its own line.
     fputs($this->stream, 'To: ' . $this->mail_to_name . ' <' . $this->mail_to_email . '>' . $this->eol . 'From: ' . $this->mail_from_name . ' <' . $this->mail_from_email . '>' . $this->eol . 'Subject: ' . $this->mail_subject . $this->eol . $headers . $this->eol . $this->eol . $this->mail_message . $this->eol . '.' . $this->eol);
     $res = fgets($this->stream, 256);
     if (substr($res, 0, 3) != "250") {
         echo $res . 'send fail<br />';
     }
     // Say bye bye
     fputs($this->stream, 'QUIT' . $this->eol);
     $res = fgets($this->stream, 256);
     if (substr($res, 0, 3) != "221") {
         echo $res . 'quit fail<br />';
     }
 }
开发者ID:jaywilliams,项目名称:ultralite,代码行数:54,代码来源:Mailer.php


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