當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。