Authored by wuxiao

修复跳转链接

@@ -85,7 +85,7 @@ class BaseController extends Controller @@ -85,7 +85,7 @@ class BaseController extends Controller
85 */ 85 */
86 public function redirect($url, $statusCode = 302) 86 public function redirect($url, $statusCode = 302)
87 { 87 {
88 - $url = (strpos($url,'http') === 0) ? $url : Yii::getAlias('@web/'.$url); 88 + $url = (strpos($url,'http') === 0) ? $url : ltrim(Yii::getAlias('@web/'.$url),'/');
89 return Yii::$app->getResponse()->redirect($url, $statusCode); 89 return Yii::$app->getResponse()->redirect($url, $statusCode);
90 } 90 }
91 91
@@ -97,7 +97,7 @@ class BaseController extends Controller @@ -97,7 +97,7 @@ class BaseController extends Controller
97 public function goBack($defaultUrl = null) 97 public function goBack($defaultUrl = null)
98 { 98 {
99 $url = Yii::$app->getUser()->getReturnUrl($defaultUrl); 99 $url = Yii::$app->getUser()->getReturnUrl($defaultUrl);
100 - $url = (strpos($url,'http') === 0) ? $url : Yii::getAlias('@web/'.$url); 100 + $url = (strpos($url,'http') === 0) ? $url : ltrim(Yii::getAlias('@web/'.$url),'/');
101 return Yii::$app->getResponse()->redirect($url); 101 return Yii::$app->getResponse()->redirect($url);
102 } 102 }
103 103
@@ -108,7 +108,8 @@ class BaseController extends Controller @@ -108,7 +108,8 @@ class BaseController extends Controller
108 */ 108 */
109 public function refresh($anchor = '') 109 public function refresh($anchor = '')
110 { 110 {
111 - return Yii::$app->getResponse()->redirect(Yii::getAlias('@web/'.Yii::$app->getRequest()->getUrl()) . $anchor); 111 + $url = ltrim(Yii::getAlias('@web/'.Yii::$app->getRequest()->getUrl()),'/') . $anchor;
  112 + return Yii::$app->getResponse()->redirect($url);
112 } 113 }
113 114
114 /** 115 /**