c# TempData equivalent in php

前端 未结 3 1173
天涯浪人
天涯浪人 2020-12-20 05:04

I know I can explicitly set and unset a Session manually but I believe this is worth to ask. In c#, there is a dictionary called TempData which stores data until the first r

3条回答
  •  没有蜡笔的小新
    2020-12-20 05:22

    You don't have that in PHP, but it shouldn't be too hard to implement it yourself. The actual implementation depends on your exact needs.

    • Do you need that data across users or separated for each user?
    • Do you want it to have a default expiration time?
    • Do you want it just in the active request or should it persist until someone retrieves it?
    • Are "misses" acceptable (see memcached) or do you want to be sure you find the data when you request it?

提交回复
热议问题