对我来说,Firefox 在 cookie 中存储了 session id (PHPSESSID) ,但是 Google Chrome 使用了 GET 或 POST 参数。
因此,您只需确保返回的脚本(对我来说是 paypal checkout)在 url 或 POST 参数中提交 PHPSESSID。
//Does retain the session info for some reason
header("Location: dir");
//Does not retain the session for some reason
header("Location: https://mywebz.com/dir")
有时候,这个问题涉及到 PHP INI 会话设置,比如没有设置 session.cookie_samesite,或者没有设置为与用例匹配。大多数 cookie/session/security 相关的错误出现在 web 浏览器的开发者控制台/网络日志中(Windows 中的 F12键) ,但是请记住每个 web 浏览器处理事情的方式是不同的。