本文整理汇总了PHP中Framework\DI\Service::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Service::getConfig方法的具体用法?PHP Service::getConfig怎么用?PHP Service::getConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Framework\DI\Service
的用法示例。
在下文中一共展示了Service::getConfig方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getViewPath
protected function getViewPath($view)
{
$basePath = Service::getConfig('basePath');
$name = Service::getConfig('name');
//{
$currentNamespace = explode('\\', get_class($this));
$controllerName = str_replace('Controller', '', array_pop($currentNamespace));
$appName = array_shift($currentNamespace);
$path = $basePath . '\\src\\' . $appName . '\\views\\' . $controllerName . '\\' . $view . '.php';
//}Разбор работает хорошо, если структура приложения меняться не будет!!
//$path = $basePath.'\\src\\'.str_replace(['Controller', '\\\\'], ['', '/'], get_class($this)).'\\'.$view.'.php';
return str_replace('\\', '/', $path);
}
示例2: getRouteClosure
public function getRouteClosure()
{
return function ($name) {
$routes = Service::getConfig('routes');
foreach ($routes as $routeName => $rContent) {
if ($name == $routeName) {
$result = Request::getHost() . $rContent['pattern'];
return $result;
}
}
return '';
};
}
示例3: send
public function send()
{
$charset = Service::getConfig('charset');
header($this->htProtocol . ' ' . $this->code . ' ' . $this->responseMessage);
header('Content-Type: ' . $this->type . '; charset=' . $charset);
header('Pragma: no-cache');
if (!empty($this->headers)) {
foreach ($this->headers as $header) {
header($header);
}
}
echo json_encode($this->content);
}
示例4: function
<?php
$activeIfRoute = function ($item) use(&$route) {
return $route['name'] === $item ? 'class="active"' : '';
};
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="<?php
echo \Framework\DI\Service::getConfig('charset');
?>
">
<title> <?php
echo $title;
?>
</title>
<link href="/css/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/css/bootstrap-theme.min.css" rel="stylesheet">
<link href="/css/my.css" rel="stylesheet">
<script type="text/javascript" src="/js/animate.js" defer></script>
</head>
<body >
<div id="particles-js" class="main">
<div id="animate-nav-bar" class="nav-bar">
<div><a href="/">Portfolio</a></div>
<div><a href="#">Services</a></div>
示例5: _initComponents
private function _initComponents()
{
$components = Service::getConfig('components');
foreach ($components as $component) {
\Loader::addNamespacePath($component['namespace'], $component['path']);
if (isset($component['bootstrap']) && $component['bootstrap'] === 'on') {
$class = $component['class'];
Service::set($component['name'], new $class());
}
}
}
示例6: __construct
public function __construct()
{
$this->session = Service::get('session');
$this->loginRoute = Service::getConfig('security')['login_route'];
}