Codeigniter falshdata中是否有最大长度? [英] Is there a maximum length in Codeigniter falshdata?

查看:81
本文介绍了Codeigniter falshdata中是否有最大长度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我之所以这么问,是因为我对我想传递给下一个视图的一则愚蠢的消息感到生气。因此,如果我这样做了:

The reason why I'm asking that is I'm becoming mad about a small stupid message I'd like to pass to the next view. So if I do :

if(!$this->paypal_pro->APICallSuccessful($PayPalResult['ACK']))
        {
            var_dump($PayPalResult['ERRORS']);
            $message=array();
            foreach ($PayPalResult['ERRORS'] as $row => $error){
                // $message['flashError'][$row]['L_SHORTMESSAGE'] = $error['L_SHORTMESSAGE'];
                $message['flashError'][$row]['test'] = "The Session class permits you maintain a user's";
                // $message['flashError'][$row]['L_ERRORCODE'] = $error['L_ERRORCODE'];
                // $message['flashError'][$row]['L_LONGMESSAGE'] = $error['L_LONGMESSAGE'];
            }
            // print_r($message);
            $this->session->set_flashdata($message);

            redirect('main/Form');
        }

效果很好,但如果我这样做:

It works great, but if I do :

    if(!$this->paypal_pro->APICallSuccessful($PayPalResult['ACK']))
    {
        var_dump($PayPalResult['ERRORS']);
        $message=array();
        foreach ($PayPalResult['ERRORS'] as $row => $error){
            // $message['flashError'][$row]['L_SHORTMESSAGE'] = $error['L_SHORTMESSAGE'];
            $message['flashError'][$row]['test'] = "The Session class permits you maintain a user's  and track their activity while";
            // $message['flashError'][$row]['L_ERRORCODE'] = $error['L_ERRORCODE'];
            // $message['flashError'][$row]['L_LONGMESSAGE'] = $error['L_LONGMESSAGE'];
        }
        // print_r($message);
        $this->session->set_flashdata($message);

        redirect('main/Form');
    }

它不起作用。

我在这里以main / form形式显示falshdata:

I'm showing the falshdata here, in main/form :

<?php if($this->session->flashdata('flashError')):?>
        <div class='flashError'>
    <?php   
        print_r($this->session->flashdata('flashError'));
    ?>
        </div>
    <?php endif?>

您可能猜到我正在尝试将Payal的错误消息拉到视图中以查找错误。
谢谢

You can guess I'm trying to pull the error messages of Payal to the view for my errors Handling. Thanks

推荐答案

我的会话有很多问题(本质上是默认情况下Cookie 。会话大小(或cookie大小)取决于浏览器,但我认为规范大约为3k-因此无法处理您打算做的事情。

I had lots of issues with sessions (which are essentially cookies by default in Codeigniter unless you store in the db). The session size (or cookie size) depends on the browser but I think the norm is around 3k - so won't handle what you are proposing to do.

不确定将会话详细信息存储在数据库中,因此添加了本地会话库,它变得容易得多(而且没有太多的错误)。您仍然可以在此库中使用CI flashdata功能(以及设置会话数据,例如$ this-> session-> set_userdata('foo',$ foo),但它允许您像使用本机PHP一样使用会话也就是说,您可以使用print_r($ _ SESSION)-我认为您无法使用CI中的默认会话功能。

I wasn't so sure about storing the session details in the db, so added the native sessions library and it has been much easier (and less buggy). You can still use the CI flashdata feature with this library (as well as set session data like $this->session->set_userdata('foo', $foo), but it allows you to use sessions just like you were using native PHP i.e. you can print_r($_SESSION) - which I don't think you can do with default session features in CI.

以下是一则包含更多信息的帖子: CodeIgniter会话与PHP会话

Here's a post with some more information: CodeIgniter sessions vs PHP sessions

这篇关于Codeigniter falshdata中是否有最大长度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆