本文整理汇总了PHP中RequestUtil::GetCurrentURL方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestUtil::GetCurrentURL方法的具体用法?PHP RequestUtil::GetCurrentURL怎么用?PHP RequestUtil::GetCurrentURL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RequestUtil
的用法示例。
在下文中一共展示了RequestUtil::GetCurrentURL方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Init
function Init()
{
$this->fh = fopen($this->filepath, "a");
$this->fileIsOpen = true;
fwrite($this->fh, "DEBUG:\t" . date("Y-m-d H:i:s:u") . "\t" . getmypid() . "\t########## ObserveToFile Initialized: " . RequestUtil::GetCurrentURL() . " ##########\r\n");
}
示例2: GetRoute
/**
* @inheritdocs
*/
public function GetRoute($uri = "")
{
if ($uri == "") {
$action = RequestUtil::Get('action');
if (!$action) {
$action = $this->_defaultRoute;
}
$uri = $action ? $action : RequestUtil::GetCurrentURL();
}
// get the action requested
$params = explode(".", str_replace("/", ".", $uri));
$controller_param = isset($params[0]) && $params[0] ? $params[0] : "";
$controller_param = str_replace(array(".", "/", "\\"), array("", "", ""), $controller_param);
if (!$controller_param) {
throw new Exception("Invalid or missing Controller parameter");
}
$method_param = isset($params[1]) && $params[1] ? $params[1] : "";
if (!$method_param) {
$method_param = "DefaultAction";
}
return array($controller_param, $method_param);
}
示例3: Exception
include_once "_app_config.php";
@(include_once "_machine_config.php");
if (!GlobalConfig::$CONNECTION_SETTING) {
throw new Exception('GlobalConfig::$CONNECTION_SETTING is not configured. Are you missing _machine_config.php?');
}
/* require framework libs */
require_once "verysimple/Phreeze/Dispatcher.php";
// the global config is used for all dependency injection
$gc = GlobalConfig::GetInstance();
try {
Dispatcher::Dispatch($gc->GetPhreezer(), $gc->GetRenderEngine(), '', $gc->GetContext(), $gc->GetRouter());
} catch (exception $ex) {
// This is the global error handler which will be called in the event of
// uncaught errors. If the endpoint appears to be an API request then
// render it as JSON, otherwise attempt to render a friendly HTML page
$url = RequestUtil::GetCurrentURL();
$isApiRequest = strpos($url, 'api/') !== false;
if ($isApiRequest) {
$result = new stdClass();
$result->success = false;
$result->message = $ex->getMessage();
$result->data = $ex->getTraceAsString();
@header('HTTP/1.1 401 Unauthorized');
echo json_encode($result);
} else {
$gc->GetRenderEngine()->assign("message", $ex->getMessage());
$gc->GetRenderEngine()->assign("stacktrace", $ex->getTraceAsString());
$gc->GetRenderEngine()->assign("code", $ex->getCode());
try {
$gc->GetRenderEngine()->display("DefaultErrorFatal.tpl");
} catch (Exception $ex2) {
示例4: IsApiRequest
/**
* Returns true if this request is an API request. This examines the URL to
* see if the string Controller::$ApiIdentifier is in the URL
* @return bool
*/
public function IsApiRequest()
{
$url = RequestUtil::GetCurrentURL();
return strpos($url, self::$ApiIdentifier) !== false;
}