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


PHP core::instance方法代码示例

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


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

示例1: getInstance

 public function getInstance()
 {
     if (!is_object($this->instance) || $this->instance == '') {
         $this->instance = core::instance('core_file');
     }
     return $this->instance;
 }
开发者ID:Junec,项目名称:core,代码行数:7,代码来源:filesystem.php

示例2: getInstance

 public static function getInstance()
 {
     if (null === self::$instance) {
         self::$instance = new self(true);
     }
     return self::$instance;
 }
开发者ID:bricksoft,项目名称:schuefo,代码行数:7,代码来源:core.php

示例3: index

 public function index()
 {
     $crontabs_model = core::instance('crontabs_model');
     $data = $crontabs_model->getList(array(), '*', 'id DESC');
     $this->assign('data', $data);
     $this->display('index.html');
 }
开发者ID:Junec,项目名称:crontabs,代码行数:7,代码来源:index.php

示例4: test

 public static function test()
 {
     $m = core::instance('crontabs_model');
     $r = $m->getAdapter()->client;
     var_dump($r);
     $cache = core_cache_factory::getInstance('filesystem');
     $cache->set('testkey', '123123123');
 }
开发者ID:Junec,项目名称:crontabs,代码行数:8,代码来源:func.php

示例5: getInstance

 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         $object = __CLASS__;
         self::$instance = new $object();
     }
     return self::$instance;
 }
开发者ID:asucrews,项目名称:nostarchBot,代码行数:8,代码来源:SHDtest.php

示例6: getInstance

 static function getInstance()
 {
     if (!isset(self::$instance)) {
         $c = __CLASS__;
         self::$instance = new $c();
     }
     return self::$instance;
 }
开发者ID:qzio,项目名称:tinly,代码行数:8,代码来源:core.php

示例7: getInstance

 public static function getInstance($type = '', $timeout = 0)
 {
     $client = "core_request_factory_{$type}";
     if (class_exists($client)) {
         return core::instance($client, $timeout);
     } else {
         throw new core_exception("request client error: " . $client . " is not exists.");
     }
 }
开发者ID:Junec,项目名称:core,代码行数:9,代码来源:factory.php

示例8: getRender

 public function getRender()
 {
     $render = core::instance('core_template');
     $render->template_dir = core::getConfig('template_dir');
     $render->compile_dir = core::getConfig('compile_dir');
     $render->tpl_left_delim = core::getConfig('tpl_left_delim');
     $render->tpl_right_delim = core::getConfig('tpl_right_delim');
     return $render;
 }
开发者ID:Junec,项目名称:core,代码行数:9,代码来源:page.php

示例9: compile

 /**
  * 编译模版文件
  *
  * @param string $tpl
  * @return void
  */
 private function compile($tpl = '')
 {
     $tplFile = $this->getTplPath($tpl);
     $compileFile = $this->getCompilePath($tpl);
     $tplContent = core::instance('core_file')->read($tplFile);
     $this->parseVar($tplContent);
     $this->parseTag($tplContent);
     $md5 = md5_file($tplFile);
     $expireTime = time();
     $tplHeader = "<?php \n/* \nCore Template Compile \nCreated on: " . date('Y-m-d H:i:s', $expireTime) . " \n*/ \n\$this->checkCompile('{$tpl}','{$md5}','{$expireTime}');\n?>\n";
     $tplContent = $tplHeader . $tplContent;
     core::instance('core_file')->write($compileFile, $tplContent);
 }
开发者ID:Junec,项目名称:core,代码行数:19,代码来源:template.php

示例10: dispatch

 /**
  * 分派执行
  * 
  * @return void
  */
 public static function dispatch()
 {
     $controller = self::$boot[self::getConfig('mvc_controller')];
     $action = self::$boot[self::getConfig('mvc_action')];
     $controllerClassName = $controller . '_controller';
     $controllerClass = core::instance($controllerClassName);
     $hashkey = core_debug::info('controller: ' . $controllerClassName . '::' . $action . '() , run ...');
     $controllerClass->exec($action);
     core_debug::info('controller: ' . $controllerClassName . '::' . $action . '() , end .', $hashkey);
     if (self::getConfig('core_debug') && strpos(PHP_SAPI, 'cli') === false) {
         core_debug::output();
     }
 }
开发者ID:Junec,项目名称:core,代码行数:18,代码来源:core.php

示例11: display

 /**
  * 模板渲染输出
  * 
  * @param string $template 模板文件
  * @return html
  */
 protected function display($template = '')
 {
     return core::instance('core_page')->display($template);
 }
开发者ID:Junec,项目名称:core,代码行数:10,代码来源:controller.php

示例12: __construct

 public function __construct()
 {
     $this->crontabsModel = core::instance('crontabs_model');
     $this->crontabsLogsModel = core::instance('crontabs_logs_model');
 }
开发者ID:Junec,项目名称:core,代码行数:5,代码来源:crontab.php

示例13: __construct

 public function __construct($options = array())
 {
     $this->client = core::instance('core_database_client_pdo', $options);
 }
开发者ID:Junec,项目名称:core,代码行数:4,代码来源:pdo.php

示例14: output

 public static function output()
 {
     $included = self::getIncludedFiles();
     $endinfo = end(self::$info);
     $sql = self::$sql;
     $sqlQueryTimes = 0;
     foreach (self::$sql as $v) {
         $sqlQueryTimes += str_replace('s', '', $v['time']);
     }
     $sqlQueryTimes = self::getFomatTime(0, $sqlQueryTimes);
     $html = "<style>.core-debug-output{ font:12px Consolas,Courier;color:#333;}.core-debug-output b{color:#2B82C7}.core-debug-output span{display:block;height:20px;line-height:20px;text-align:left;padding-left:5px;background:#F3F3F3;}.core-debug-output p{margin:0;padding:3px 5px;border-bottom:0px solid #ddd;}.core-debug-output p font{}.core-debug-table{font-size:12px;}.core-debug-table tr td{background:#F4F4F4;}</style>";
     //Basic
     $html .= "<div class='core-debug-output'><span><b>Basic</b></span>";
     $html .= "<table class='core-debug-table'>\r\n            <tr>\r\n                <td>RunTime</td>\r\n                <td>" . $endinfo['time'] . "</td>\r\n            </tr>\r\n            <tr>\r\n                <td>Memory</td>\r\n                <td>" . $endinfo['memory'] . "</td>\r\n            </tr>\r\n            <tr>\r\n                <td>Include</td>\r\n                <td>" . count($included) . "</td>\r\n            </tr>\r\n            <tr>\r\n                <td>Cache</td>\r\n                <td>SET=" . self::getCounter('cache_set') . " GET=" . self::getCounter('cache_get') . " DELETE=" . self::getCounter('cache_delete') . " FLUSH=" . self::getCounter('cache_flush') . "</td>\r\n            </tr>\r\n        </table>";
     $html .= "</div>";
     //Flow
     $html .= "<div class='core-debug-output'><span><b>Flow</b>  (" . count(self::$info) . ")</span><table class='core-debug-table'><tr><td width=15%>*Time</td><td width=15%>*Memory</td><td>*Info</td></tr>";
     foreach (self::$info as $v) {
         $html .= "<tr>\r\n            <td>" . $v['time'] . "</td>\r\n            <td>" . $v['memory'] . "</td>\r\n            <td>" . $v['info'] . "</td></tr>";
     }
     $html .= "</table></div>";
     //Include
     $html .= "<div class='core-debug-output'><span><b>Include</b> (" . count($included) . ")</span><table class='core-debug-table'><tr><td width=15%>*Size</td><td>*File</td></tr>";
     foreach ($included as $v) {
         $fileinfo = core::instance('core_file')->getFileInfo($v);
         $html .= "<tr>\r\n            <td>" . self::getSizeUsage($fileinfo['size']) . "</td>\r\n            <td>" . $v . "</td></tr>";
     }
     $html .= "</table></div>";
     echo $html;
 }
开发者ID:Junec,项目名称:core,代码行数:30,代码来源:debug.php

示例15: getInstance

 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new core();
     }
     return self::$instance;
 }
开发者ID:hellojo84,项目名称:99ko,代码行数:7,代码来源:core.class.php


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