Wiki

Clone wiki

yii-stuff / force-http_s

Принудительное подключение через HTTP(s)

Файлы фильтров находятся в /protected/components, в своем приложении их можно оставить там же, в принципе

Использование

В коде контроллера пишем:

<?php
public function filters()
{
	return array(
		'https +new, payment',
		'http +index, complete'
	);
}
?>

Где new, payment, index, complete — имена экшенов.

Создание ссылок:

<?php
CHtml::link('Subscribe', $this->createAbsoluteUrl('subscription/new',array(),'https'));
?>

Перенаправление на другой протокол:

<?php $this->redirect($this->createAbsoluteUrl('subscription/complete',array(),'http'));?>

Автор: Pablovp

Updated