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


PHP base::getInstance方法代码示例

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


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

示例1: link_tag

function link_tag($href = '', $rel = 'stylesheet', $type = 'text/css', $title = '', $media = '', $index_page = FALSE)
{
    $OB = base::getInstance();
    $link = '<link ';
    if (is_array($href)) {
        foreach ($href as $k => $v) {
            if ($k == 'href' and strpos($v, '://') === FALSE) {
                if ($index_page === TRUE) {
                    $link .= ' href="' . $OB->config->site_url($v) . '" ';
                } else {
                    $link .= ' href="' . $OB->config->slash_item('base_url') . $v . '" ';
                }
            } else {
                $link .= "{$k}=\"{$v}\" ";
            }
        }
        $link .= "/>";
    } else {
        if (strpos($href, '://') !== FALSE) {
            $link .= ' href="' . $href . '" ';
        } elseif ($index_page === TRUE) {
            $link .= ' href="' . $OB->config->site_url($href) . '" ';
        } else {
            $link .= ' href="' . $OB->config->slash_item('base_url') . $href . '" ';
        }
        $link .= 'rel="' . $rel . '" type="' . $type . '" ';
        if ($media != '') {
            $link .= 'media="' . $media . '" ';
        }
        if ($title != '') {
            $link .= 'title="' . $title . '" ';
        }
        $link .= '/>';
    }
    return $link;
}
开发者ID:anugrahbsoe,项目名称:Becak-HMVC-Framework,代码行数:36,代码来源:head_tag_helper.php

示例2: this

function this()
{
    return base::getInstance();
}
开发者ID:anugrahbsoe,项目名称:Becak-HMVC-Framework,代码行数:4,代码来源:base.php

示例3: _assign_db_objects

 public function _assign_db_objects()
 {
     foreach (base::$databases as $key) {
         $this->{$key} =& base::getInstance()->{$key};
     }
 }
开发者ID:anugrahbsoe,项目名称:Becak-HMVC-Framework,代码行数:6,代码来源:model.php

示例4: _write_cache

 public function _write_cache($output)
 {
     $OB = base::getInstance();
     //$path = common::config_item('cache_path', 'cache');
     $cache_path = APP . 'cache' . DS;
     //= ($path == '') ?  APP.'system'.DS.'cache'.DS : $path;
     if (!is_dir($cache_path) or !common::is_really_writable($cache_path)) {
         throw new Exception('Unable to write cache file: ' . $cache_path);
         return;
     }
     $uri = $OB->config->item('base_url') . $OB->config->item('index_page') . $OB->uri->uri_string();
     $cache_path .= md5($uri);
     if (!($fp = @fopen($cache_path, FOPEN_WRITE_CREATE_DESTRUCTIVE))) {
         throw new Exception('Unable to write cache file: ' . $cache_path);
         return;
     }
     $expire = time() + $this->cache_expiration * 60;
     if (flock($fp, LOCK_EX)) {
         fwrite($fp, $expire . 'TS--->' . $output);
         flock($fp, LOCK_UN);
     } else {
         throw new Exception('Unable to secure a file lock for file at: ' . $cache_path);
         return;
     }
     fclose($fp);
     @chmod($cache_path, DIR_WRITE_MODE);
     //log_message('debug', "Cache file written: ".$cache_path);
 }
开发者ID:anugrahbsoe,项目名称:Becak-HMVC-Framework,代码行数:28,代码来源:output_library.php

示例5: database

 public static function database($db_name = 'db')
 {
     $db_var = $db_name;
     $obj = base::getInstance();
     if (isset($obj->{$db_var}) and is_object($obj->{$db_var})) {
         return;
     }
     require SYS . 'database' . DS . 'db_factory' . PHP_EXT;
     $obj->{$db_var} = db_factory::callDB($db_name);
     base::$databases[$db_var] = $db_var;
     if (count(base::$models) >= 0) {
         foreach (base::$models as $model_name) {
             $obj->{$model_name}->{$db_var} =& $obj->{$db_var};
         }
     }
 }
开发者ID:anugrahbsoe,项目名称:Becak-HMVC-Framework,代码行数:16,代码来源:loader.php


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