简体   繁体   中英

Clear joomla Session array values

I have a search form with 3 multi-selections. Everything works fine, but when I go back to the page the previous choice remains stored, even if nothing is selected in the field. I thought about cleaning the session:

in my search page:

$session = JFactory::getSession();
$session->clear('com_jsjobsprovincia', null);
$session->clear('com_jsjobsjobcategory', null);
$session->clear('com_jsjobsjobsubcategory', null);

But don't work.

I tried to print the session:

[com_jsjobsjobcategory] => Array
                                (
                                    [0] => 1
                                    [1] => 2
                                )

                            [com_jsjobsjobsubcategory] => Array
                                (
                                    [0] => 1
                                    [1] => 111
                                )

                            [com_jsjobsprovincia] => Array
                                (
                                    [0] => 242
                                    [1] => 243
                                )

How should i do? thank you

pa

我认为您应该使用$session->setVar('com_jsjobsprovincia', null);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM