本文整理汇总了PHP中Dispatcher::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Dispatcher::__construct方法的具体用法?PHP Dispatcher::__construct怎么用?PHP Dispatcher::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dispatcher
的用法示例。
在下文中一共展示了Dispatcher::__construct方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @param $path
* @param $controller_root
* @param $view_root
* @param $use_routes
* @param $force_routes
*/
public function __construct($path = null, $controller_root = null, $view_root = null, $use_routes = true, $force_routes = false)
{
$args = parse_args();
$switches = parse_switches();
$path = $path ? $path : $args[0];
array_shift($args);
$controller_root = $controller_root ? $controller_root : PATH_APP . 'shell/controller/';
$view_root = $view_root ? $view_root : PATH_APP . 'shell/view/';
parent::__construct($path, $controller_root, $view_root, $use_routes, $force_routes);
$this->segments = $args;
}
示例2: __construct
/**
* Constructor
*
* @param $path
* @param $controller_root
* @param $view_root
* @param $use_routes
* @param $force_routes
*/
public function __construct($path=null,$controller_root=null,$view_root=null,$use_routes=true,$force_routes=false)
{
if ($path==null)
{
$path = (isset ($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : @ getenv('PATH_INFO');
$path = rtrim(strtolower($path), '/');
}
else
{
$query_pos = strpos($path,'?');
if ($query_pos)
{
$query = substr($path,$query_pos+1);
$this->query = new Query($query);
$path = substr($path,0,$query_pos); // remove query part for Dispatcher
}
}
// fetch the view conf
$viewconf=Config::Get('request_types');
$default_engine=$viewconf->default;
// set the default extension
$extension=EXT;
// if request type hasn't been specified
// run it through the map to see if we get a hit.
$req_type=$default_engine;
try
{
foreach($viewconf->map as $item)
{
switch($item->test)
{
case 'server':
$array=&$_SERVER;
break;
case 'get':
$array=&$_GET;
break;
case 'post':
$array=&$_POST;
break;
case 'env':
$array=&$_ENV;
break;
}
if (isset($array[$item->key]))
{
if ($item->matches)
{
if (preg_match("#{$item->matches}#",$array[$item->key]))
{
$req_type=$item->type;
break;
}
}
else
{
$req_type=$item->type;
break;
}
}
}
}
catch (ConfigInvalidFormatException $fex)
{
throw $fex;
}
catch (ConfigException $ex)
{
}
self::$req_type=$req_type;
parent::__construct($path,$controller_root,$view_root,$use_routes,$force_routes);
}
示例3:
/**
* Constructor
*
* @param $module Module to display
* @param $action action to execute
* @param $params Modules parameters
* @return string
*/
function __construct($module, $action = 'index', $params = null)
{
parent::__construct($module, $action, $params);
}