Cakephp会话毁灭

时间:2011-07-20 11:25:55

标签: php cakephp

如何销毁会话变量?我想在trip会话变量中销毁除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中执行此操作?

1 个答案:

答案 0 :(得分:1)

我认为你想要“删除”,而不是“破坏”,因为破坏会清除一切:

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

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