解决PHP7下Session callback expects true/false return value in 问题

升级项目致PHP7遇到Session报警告,既然升级新版本,警告什么的肯定要一起都处理了

经过跟踪排查,发现是到session_start这一步遇到问题,session_start()使用你之前通过session_set_save_handler(….)方法设置的处理器,现在PHP7要求必须返回true/false,所以你需要检查一下你的这些处理器方法是否准确返回true/false了

session_start() uses any handlers you’ve previously set with session_set_save_handler(…), and that handler (or the individual functions) must return a true/false result to signal success or failure. You have a handler that does not return a true/false result. To recap; the actual error is the implementation of your session handler, not the code that calls session_start().

3条留言
  1. 感谢分享,学习了,拜访博主

  2. 具体怎么弄呢?看不太懂呢

    1. 检查一下你的session_start()映射方法,是否返回true/false