本文整理汇总了PHP中SS_HTTPRequest::setURL方法的典型用法代码示例。如果您正苦于以下问题:PHP SS_HTTPRequest::setURL方法的具体用法?PHP SS_HTTPRequest::setURL怎么用?PHP SS_HTTPRequest::setURL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SS_HTTPRequest
的用法示例。
在下文中一共展示了SS_HTTPRequest::setURL方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preRequest
/**
* Gets the active domain, and sets its URL to the native one, with a vanity
* URL in the request
*
* @param SS_HTTPRequest $request
* @param Session $session
* @param DataModel $model
*/
public function preRequest(SS_HTTPRequest $request, Session $session, DataModel $model)
{
if (Director::is_cli()) {
return;
}
// Not the best place for validation, but _config.php is too early.
if (!MultiDomain::get_primary_domain()) {
throw new Exception('MultiDomain must define a "' . MultiDomain::KEY_PRIMARY . '" domain in the config, under "domains"');
}
foreach (MultiDomain::get_all_domains() as $domain) {
if (!$domain->isActive()) {
continue;
}
$url = $this->createNativeURLForDomain($domain);
$parts = explode('?', $url);
$request->setURL($parts[0]);
}
}