看一下这篇文章http://www.yiiframework.com/forum/index.php/topic/25407-forcing-https-in-yii/
class HttpsFilter extends CFilter {
protected function preFilter( $filterChain ) {
if ( !Yii::app()->getRequest()->isSecureConnection ) {
# Redirect to the secure version of the page.
$url = 'https://' .
Yii::app()->getRequest()->serverName .
Yii::app()->getRequest()->requestUri;
Yii::app()->request->redirect($url);
return false;
}
return true;
}
}
Run Code Online (Sandbox Code Playgroud)
即使此了解更多详情.
| 归档时间: |
|
| 查看次数: |
5841 次 |
| 最近记录: |