Yii $ loginUrl = '/' sorunu (giriş sayfasına yönlendirme değil)

0 Cevap php

I've noticed that if your site is located at the root of the domain, like www.example.com instead of www.example.com/website/ then if you set your $loginUrl='/' in the config of Yii, the redirection will not work, because the url is stripped to an empty string while processing. To overcome that I've added

public function init() {
    parent::init();
    $this->loginUrl = Yii::app()->getRequest()->getBaseUrl(true);
}

Benim WebUser.php içinde

Ben bu kişiye yardımcı olacağını umuyoruz.

Ancak, herkes yapmanın daha iyi bir yolunu biliyor

$this->redirect('/');

kontrol yerine de

$this->redirect(Yii::app()->getRequest()->getBaseUrl(true));

0 Cevap