本文整理汇总了PHP中CWebUser::setReturnUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP CWebUser::setReturnUrl方法的具体用法?PHP CWebUser::setReturnUrl怎么用?PHP CWebUser::setReturnUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CWebUser
的用法示例。
在下文中一共展示了CWebUser::setReturnUrl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getReturnUrl
/**
* Returns the URL the user was trying to access before getting redirected to the login page via
* {@link requireLogin()}.
*
* @param string|null $defaultUrl The default URL that should be returned if no return URL was stored.
* @param bool $delete Whether the stored return URL should be deleted after it was fetched.
*
* @return string|null The return URL, or $defaultUrl.
*/
public function getReturnUrl($defaultUrl = null, $delete = false)
{
$returnUrl = $this->getState('__returnUrl');
if ($returnUrl !== null) {
// Strip out any tags that may have gotten in there by accident
// i.e. if there was a {siteUrl} tag in the Site URL setting, but no matching environment variable,
// so they ended up on something like http://example.com/%7BsiteUrl%7D/some/path
$returnUrl = str_replace(array('{', '}'), array('', ''), $returnUrl);
// Should we delete it?
if ($delete) {
parent::setReturnUrl(null);
}
}
if ($returnUrl === null) {
$returnUrl = $defaultUrl;
}
if ($returnUrl !== null) {
return UrlHelper::getUrl($returnUrl);
}
}