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


PHP app::gi方法代码示例

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


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

示例1: parse

 function parse($path)
 {
     $request = $_REQUEST;
     $request['controller'] = app::gi()->config->default_controller;
     $request['action'] = app::gi()->config->default_action;
     $request['id'] = 0;
     $parts = parse_url($path);
     if (isset($parts['query']) and !empty($parts['query'])) {
         $path = str_replace('?' . $parts['query'], '', $path);
         parse_str($parts['query'], $req);
         $request = array_merge($request, $req);
     }
     foreach (app::gi()->config->router as $rule => $keypath) {
         if (preg_match('#' . $rule . '#sui', $path, $list)) {
             for ($i = 1; $i < count($list); $i = $i + 1) {
                 $keypath = preg_replace('#\\$[a-z0-9]+#', $list[$i], $keypath, 1);
             }
             $keypath = explode('/', $keypath);
             foreach ($keypath as $i => $key) {
                 $request[$this->path_elements[$i]] = $key;
             }
         }
     }
     return $request;
 }
开发者ID:KGB-Steam,项目名称:test,代码行数:25,代码来源:Router.php

示例2: start

 function start()
 {
     $this->uri = new Registry(Router::gi()->parse($_SERVER['REQUEST_URI']));
     $controller = app::gi($this->uri->controller . 'Controller');
     ob_start();
     $controller->__call('action' . $this->uri->action, array($this->uri->id));
     $content = ob_get_clean();
     if ($this->config->scripts and is_array($this->config->scripts)) {
         foreach ($this->config->scripts as $script) {
             $controller->addScript($script);
         }
     }
     if ($this->config->styles and is_array($this->config->styles)) {
         foreach ($this->config->styles as $style) {
             $controller->addStyleSheet($style);
         }
     }
     $controller->renderPage($content);
 }
开发者ID:sania00,项目名称:ideal,代码行数:19,代码来源:App.php

示例3: dirname

      <div class="container">
        <nav class="blog-nav">
          <a class="blog-nav-item <?php 
echo app::gi()->uri->controller == 'index' ? 'active' : '';
?>
" href="/">Главная</a>
          <a class="blog-nav-item <?php 
echo app::gi()->uri->controller == 'user' ? 'active' : '';
?>
" href="/user/">Войти</a>
          <a class="blog-nav-item <?php 
echo app::gi()->uri->controller == 'page' ? 'active' : '';
?>
" href="/about.html">О фреймворке</a>
          <a class="blog-nav-item <?php 
echo app::gi()->uri->controller == 'post' ? 'active' : '';
?>
" href="/post">Материалы</a>
        </nav>
      </div>
    </div>

    <div class="container">
		<?php 
include dirname(__FILE__) . '/layouts/' . $this->layout . '.php';
?>
    </div><!-- /.container -->
    <footer class="blog-footer">
		<p><a href="#">Наверх</a></p>
    </footer>
	<?php 
开发者ID:sania00,项目名称:ideal,代码行数:31,代码来源:main.php

示例4: dirname

                <a class="blog-nav-item <?php 
    echo app::gi()->uri->controller == 'feedback' ? 'active' : '';
    ?>
" href="/questions/">Вопросы</a>
                <a class="blog-nav-item <?php 
    echo app::gi()->uri->controller == 'user' ? 'active' : '';
    ?>
" href="/user/"><?php 
    echo $_SESSION['login'];
    ?>
</a>
            <?php 
} else {
    ?>
                <a class="blog-nav-item <?php 
    echo app::gi()->uri->controller == 'user' ? 'active' : '';
    ?>
" href="/user/login/">Вход</a>
            <?php 
}
?>
        </nav>
      </div>
    </div>

    <div class="container">
		  <?php 
include dirname(__FILE__) . '/layouts/' . $this->layout . '.php';
?>
    </div><!-- /.container -->
    <footer class="blog-footer">
开发者ID:KGB-Steam,项目名称:test,代码行数:31,代码来源:main.php

示例5: define

<?php

define('ROOT', dirname(__FILE__) . '/');
define('IDEAL', dirname(__FILE__) . '/ideal/');
define('APP', dirname(__FILE__) . '/application/');
include IDEAL . 'framework.php';
app::gi()->start();
开发者ID:sania00,项目名称:ideal,代码行数:7,代码来源:main.php


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