2012-10-13 20 views

cevap

12

kullanın session flashdata mesajınız

http://testsite/test/site/controller/method/meesage

Pass ve $this->uri->segment(3)

Sen URL içinden mesajın geçmesi yerine de oturumu kullanabilirsiniz kullanmak - bu onun için tasarlanmış tam olarak ne :

if(!validate) 
{ 
    $this->session->set_flashdata('error', 'your_error'); 
    redirect('/poll/list'); 
} 

Ardından anket/liste işlevi içinde:

$error_msg = $this->session->flashdata('error'); 
+0

Çok teşekkürler, bu benim aradığım ve örnek kod – mko

+0

En yeni URL için 1 am Tam olarak ne olduğunu: http://ellislab.com/codeigniter/ kullanıcı kılavuzu/libraries/sessions.html – Leo

1
base url = 'http://localhost/site/' 

URLhttp://localhost/site/controller/method

$this->uri->segment(1) = 'controller' 
$this->uri->segment(2) = 'method' 

Şimdi aşağıdaki durumda da

base url = 'http://testsite/test/site/' 

URLhttp://testsite/test/site/controller/method

$this->uri->segment(1) = 'controller' 
$this->uri->segment(2) = 'method' 
kontrol

..

İlgili konular