本文整理匯總了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;
}
}