dongyan1993 2016-09-22 21:45
浏览 73
已采纳

类'SessionHandler'找不到PHP 5.3.3

I am having big issues implementing SessionHandler class on my app.

Unfortunately, I am stuck on 5.3.3 version and I can't upgrade to a newer version, because our server has to use that version.

Is there any alternative solution to implement SessionHandler class?

By looking into documentation, SessionHandler requires min 5.4 version.

Thanks.

  • 写回答

1条回答 默认 最新

  • douwaif22244 2016-09-22 22:00
    关注

    Right, the SessionHandler interface was not implemented in PHP until PHP 5.4. Unfortunately, PHP 5.3 reached its end of life over 2 years ago. If you're using anything prior to PHP 5.6.0, right now, you're using a version of PHP that will no longer receive updates or support. So you will not be able to take advantage of such new features that newer and current versions of PHP have to offer.

    The SessionHandler interface is the only interface exposed to userland PHP that allows you to hook directly int PHP's session handler. Prior to that you had to write your own custom session handling code as a C extension to register it as one of the session_save_handlers that PHP would use to handle sessions.

    Since you have no direct interface you're forced to do this type of thing ad-hoc in your unsupported version of PHP. i.e. by reading directly from your session storage, deserializing it manually, writing your own wrappers, and then serializing and writing back out to your storage location.

    This means you would not be able to take advantage of any of PHP's built-in features to rely on doing so, such as session_start(), session_write_close(), or the $_SESSION super global variable. You will have to wrap all of these things in your own PHP code and will be forced to call on your own PHP abstraction throughout your application code to deal with the session calls for you.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化