當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Logs::access方法代碼示例

本文整理匯總了PHP中Logs::access方法的典型用法代碼示例。如果您正苦於以下問題:PHP Logs::access方法的具體用法?PHP Logs::access怎麽用?PHP Logs::access使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Logs的用法示例。


在下文中一共展示了Logs::access方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: start

 public function start($url)
 {
     Logs::access("Connection to url " . $url);
     \Twig_Autoloader::register();
     $loader = new \Twig_Loader_Filesystem('src/View');
     $twig = new \Twig_Environment($loader);
     $url = explode("/", $url);
     isset($url[0]) ? $controller = $url[0] : ($controller = null);
     isset($url[1]) ? $action = $url[1] : ($action = null);
     isset($url[2]) ? $param = $url[2] : ($param = null);
     if ($controller != null) {
         if (array_key_exists($controller, $this->route)) {
             if ($action != null && in_array($action, $this->route[$controller])) {
                 $response['controller'] = $controller;
                 $response['action'] = $action;
                 $response['param'] = $param;
                 $namespace = "\\App\\Controller\\" . $controller;
                 $controller = new $namespace();
                 $response['result'] = $controller->{$action}($param);
                 $response["template"] = $twig->loadTemplate($response['controller'] . '/' . $response['action'] . '.twig');
                 return $response;
             } else {
                 $response['controller'] = $controller;
                 $response['action'] = 'index';
                 $response['param'] = $action;
                 $namespace = "\\App\\Controller\\" . $controller;
                 $controller = new $namespace();
                 $response['result'] = $controller->index();
                 $response["template"] = $twig->loadTemplate($response['controller'] . '/index.twig');
                 return $response;
             }
         } else {
             Logs::error("No controller " . $controller . ' Found');
             $controller = "Home";
             $response['controller'] = $controller;
             $response['action'] = 'index';
             $namespace = "\\App\\Controller\\" . $controller;
             $controller = new $namespace();
             $response['result'] = $controller->index();
             $response["template"] = $twig->loadTemplate('Home/index.twig');
             return $response;
         }
     } else {
         $controller = "Home";
         $response['controller'] = $controller;
         $response['action'] = 'index';
         $namespace = "\\App\\Controller\\" . $controller;
         $controller = new $namespace();
         $response['result'] = $controller->index();
         $response["template"] = $twig->loadTemplate('Home/index.twig');
         return $response;
     }
 }
開發者ID:YounesBoulkaddid,項目名稱:Framework,代碼行數:53,代碼來源:Router.php


注:本文中的Logs::access方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。