闪存数据在codeigniter中不起作用

时间:2017-01-11 07:23:54

标签: codeigniter

在控制器中

    public static void main(String[] args) {
        String str = Generator.getSaltString();
        str += '\0';
        System.out.println("C style string to reverse: " + str + "****");
        reverse(str);
    }

    private static String reverse(String str) {
        int length = str.length();
        char[] chars = new char[length];
        int j = 0;
        for (int i = length - 1; i >= 0; i--) {
            chars[j++] = str.charAt(i);
        }
        String resultStr = new String(chars);
        System.out.println("****" + resultStr + "********");
        return resultStr;
    }

in veiw

if($this->email->send()) 
    {
       $this->session->keep_flashdata("msg", "<div class='alert alert-error' style='background: rgba(22, 111, 24, 0.84); color: #fff;'>
                <button class='close' data-dismiss='alert'>&times;</button>
                <strong>Sucess..!</strong> We sent a activation link to " .$email. ". Please Activate your account. 
            </div>");   
        redirect('Home/clients');
    }

但重定向flashdata后没有打印任何消息。 请帮帮我

提前致谢

1 个答案:

答案 0 :(得分:0)

而不是$this->session->keep_flashdata使用$this->session->set_flashdata

另请不要忘记加载库

 $this->load->library('session'); 
 $this->load->helper('url');