本文整理汇总了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;
}
示例2: getInstance
public static function getInstance()
{
if (null === self::$instance) {
self::$instance = new self(true);
}
return self::$instance;
}
示例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');
}
示例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');
}
示例5: getInstance
public static function getInstance()
{
if (!isset(self::$instance)) {
$object = __CLASS__;
self::$instance = new $object();
}
return self::$instance;
}
示例6: getInstance
static function getInstance()
{
if (!isset(self::$instance)) {
$c = __CLASS__;
self::$instance = new $c();
}
return self::$instance;
}
示例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.");
}
}
示例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;
}
示例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);
}
示例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();
}
}
示例11: display
/**
* 模板渲染输出
*
* @param string $template 模板文件
* @return html
*/
protected function display($template = '')
{
return core::instance('core_page')->display($template);
}
示例12: __construct
public function __construct()
{
$this->crontabsModel = core::instance('crontabs_model');
$this->crontabsLogsModel = core::instance('crontabs_logs_model');
}
示例13: __construct
public function __construct($options = array())
{
$this->client = core::instance('core_database_client_pdo', $options);
}
示例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;
}
示例15: getInstance
public static function getInstance()
{
if (is_null(self::$instance)) {
self::$instance = new core();
}
return self::$instance;
}