Ejemplo n.º 1
0
 /**
  * 构造函数,初始化视图实例,调用hook
  */
 public function __construct()
 {
     $this->Geter = \G\Geter::getInstance();
     $this->router = C('Router');
     $this->env = C('env');
     $this->app = C('app');
     $this->rules = C('rules');
     $this->headers = C('headers');
     $this->params = $this->router['params'];
     $this->env['bt'] = $_SERVER['REQUEST_TIME_FLOAT'];
     $this->env['ip'] = $this->env['REMOTE_ADDR'];
     $this->env['mem'] = memory_get_usage();
     //
     //        // 依赖注入
     $this->singleton('S', function ($c) {
         return \Seter\Seter::getInstance();
     });
     //
     //        /**
     //         * 无依赖或者只抵赖底层的 route属于最底层,可以在conf中进行变量的配置
     //         * /
     $this->singleton('db', function ($c) {
         return $this->S->db;
     });
     $this->singleton('table', function ($c) {
         return $this->S->table;
     });
     $this->singleton('Model', function ($c) {
         return $this->S->model;
     });
     $this->singleton('request', function ($c) {
         return $this->S->request;
     });
     //            $this->singleton('user', function ($c) {
     //                  return $this->S->user;
     //            });
     $this->singleton('rbac', function ($c) {
         return $this->S->rbac;
     });
     $this->_view = new View();
 }
Ejemplo n.º 2
0
function Ge($str = '')
{
    return \G\Geter::getInstance()->get($str);
}
Ejemplo n.º 3
0
<?php

/**
 * 对G的测试代码
 */
error_reporting(E_ALL ^ E_NOTICE);
//抑制错误
include '../../Grace/Common.php';
//基础函数
include '../../App/Seter/I.php';
//入口代码
$m['app'] = G('../../App/Conf.php');
C($m);
//建立配置文件
$d = \G\Geter::getInstance();
//$d->show();                //调试
//$d->display();             //调试
//D($d->get('debug.display'));       //调试
//D($d->get('debug.show'));          //调试
//D($d->get('user.show'));           //调试
D(Ge('user.show'));
Ejemplo n.º 4
0
						<?php 
    if ($value) {
        foreach ($value as $k => $v) {
            ?>
									<div class="set" >   <!-- or <div class="set "> -->
										  <div class="inner-set" id="s<?php 
            echo $key . $k;
            ?>
">
												<div class="set-description">
													  <h3><?php 
            echo $key . '.' . $k;
            ?>
</h3>
													  <div class="markdown"><?php 
            D(\G\Geter::getInstance()->get($key . '.' . $k));
            ?>
</div>
												</div>

												<div class="set-curl">
													  <h3><?php 
            echo $key . '.' . $k;
            ?>
</h3>
													  <div class="markdown">
                                                      $this->G('<?php 
            echo $key . '.' . $k;
            ?>
');
                                                      <br>