【问题标题】:cache or session in a search form [closed]搜索表单中的缓存或会话[关闭]
【发布时间】:2012-05-15 02:49:50
【问题描述】:

我想缓存从帖子表单中收集的搜索条件。就像年龄 >20 或性别是男性一样。 然后,如果我使用分页,当我单击下一页时,我可以很快得到搜索。 但我对在 php mvc 框架 kohana 3.2 中工作感到困惑。 谁能给我演示一下?

【问题讨论】:

    标签: model-view-controller caching search pagination kohana


    【解决方案1】:

    看看Session 类:

    Session::instance()->set($key, $value);
    
    $value = Session::instance()->get($key);
    if ($value) {
        // do something with the value
    }
    

    【讨论】:

    • 当然,我知道。但就这么容易吗?一样的感谢。
    • 是的,只需使用Session::instance()->set 将您的值从一页保存到另一页,然后使用Session::instance()->get 将它们取回。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-26
    • 1970-01-01
    • 2023-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多