【问题标题】:Cakephp session destroyCakephp 会话销毁
【发布时间】:2011-07-20 11:25:55
【问题描述】:

如何销毁会话变量?我想在 trips 会话变量中销毁除 TripVic 之外的所有内容。下面是输出。

谢谢。

Array
(
    [0] => Array
        (
            [TripVic] => Array
                (
                    [id] => 562
                    [date] => 1311043156
                    [distance_travelled] => 0
                    [driving_time] => 3
                    [start_time] => 1311043156
                    [end_time] => 1311043160
                    [duration] => 3
                    [night_driving_time] => 0
                    [odometer_start] => 1
                    [odometer_finish] => 1
                    [condition_road_freeway] => 1
                    [condition_road_gravel] => 1
                    [condition_road_inner_city] => 1
                    [condition_road_main] => 1
                    [condition_road_other_rural] => 1
                    [condition_road_residential] => 1
                    [condition_road_rural_highway] => 1
                    [condition_traffic_heavy] => 1
                    [condition_traffic_light] => 1
                    [condition_traffic_moderate] => 1
                    [condition_weather_dry] => 1
                    [condition_weather_wet] => 1
                    [condition_light_day] => 1
                    [condition_light_dusk] => 1
                    [condition_light_night] => 1
                    [user_id] => 292
                    [car_id] => 525
                    [instructor_id] => 436
                    [stationary_flag] => 0
                    [supervisor_signature] => 2921311043150.jpeg
                    [total_time_remaining] => 0
                    [total_time_driven] => 0
                    [total_night_time_driven] => 0
                    [total_day_time_driven] => 0
                    [total_distance] => 0
                    [total_day_driving_at_this_trip] => 130
                    [total_night_driving_at_this_trip] => 92
                    [total_time_driven_at_this_trip] => 222
                    [total_time_remaining_at_this_trip] => 431777
                    [total_distance_driven_at_this_trip] => 0
                )

            [User] => Array
                (
                    [id] => 292
                    [email] => haibin@vic.com
                    [password] => 82e62b2902c6eae80cb914c32b03c5c61b8f37f5
                    [name] => haibin
                    [licence] => 123
                    [phone] => 
                    [suburb] => vic
                    [state_id] => 1
                    [group_id] => 2
                    [qualified_seconds] => 0
                    [created] => 2011-07-06 16:29:47
                    [modified] => 2011-07-06 16:29:47
                )

            [Car] => Array
                (
                    [id] => 525
                    [nick_name] => Car
                    [licence] => REG
                    [is_default] => 1
                    [user_id] => 292
                )

            [Instructor] => Array
                (
                    [id] => 436
                    [name] => Super
                    [licence] => 123456
                    [is_default] => 1
                    [is_qualified] => 1
                    [driving_school] => School
                    [user_id] => 292
                    [state_id] => 1
                )

            [TripVicCoords] => Array
                (
                )

        )

如何在 CakePHP 中做到这一点?

【问题讨论】:

标签: php cakephp


【解决方案1】:

我认为您想要“删除”而不是“销毁”,因为销毁会清除所有内容:

$this->Session->delete([what you want to delete]);

http://book.cakephp.org/view/402/delete

【讨论】:

    猜你喜欢
    • 2011-07-18
    • 1970-01-01
    • 2011-11-25
    • 1970-01-01
    • 2013-04-01
    • 1970-01-01
    • 2012-05-25
    • 2011-11-06
    • 1970-01-01
    相关资源
    最近更新 更多