本文整理汇总了PHP中RequestHandler::activeRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestHandler::activeRequest方法的具体用法?PHP RequestHandler::activeRequest怎么用?PHP RequestHandler::activeRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RequestHandler
的用法示例。
在下文中一共展示了RequestHandler::activeRequest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Creates a new RequestHandler object.
*
* @param string $className
* @param array $applicationDir
* @param string $type
*/
protected function __construct($className, $applicationDir, $type)
{
self::$activeRequest = $this;
try {
// validate class name
if (!preg_match('/^[a-z0-9_]+$/i', $className)) {
throw new SystemException("Illegal class name '" . $className . "'", 11009);
}
// find class
$className = ucfirst($className) . ucfirst($type);
$classPath = $type . '/' . $className . '.class.php';
$found = false;
foreach ($applicationDir as $dir) {
if (file_exists($dir . $classPath)) {
$classPath = $dir . $classPath;
$found = true;
break;
}
}
if (!$found) {
throw new SystemException("unable to find class file '" . $classPath . "'", 11000);
}
} catch (SystemException $e) {
throw new IllegalLinkException();
}
// define vars
$this->type = $type;
$this->{$type} = $className;
// include class
require_once $classPath;
// execute class
if (!class_exists($className)) {
throw new SystemException("unable to find class '" . $className . "'", 11001);
}
$this->controllerObj = new $className();
}