最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - Session conflicts when multiple fat-free-framework based apps are running on the same browser - Stack Overflow

programmeradmin1浏览0评论

When two F3 applications hosted on the same domain are running on the same browser, the session variables are getting erased and hence causing conflicts.

Is there anyway I can create session namespaces in F3? Something like using the session_name() method in the native PHP sessions?

When two F3 applications hosted on the same domain are running on the same browser, the session variables are getting erased and hence causing conflicts.

Is there anyway I can create session namespaces in F3? Something like using the session_name() method in the native PHP sessions?

Share Improve this question edited Mar 13 at 15:20 libregeek asked Mar 13 at 14:27 libregeeklibregeek 1,29411 silver badges23 bronze badges 3
  • I'm not familiar with F3, but normally session cookies are related to domain names. Do your apps (websites?) share a domain? – KIKO Software Commented Mar 13 at 14:43
  • @KIKOSoftware Yes. it's hosted on the same domain. I updated my question. – libregeek Commented Mar 13 at 15:20
  • Well, PHP scrips, running under the same domain, share their session cookies, and therefore their session values in $_SESSION. That is, if F3 uses that. The solution would be to use different (sub)domains for different apps, or to write code in such a way that apps can share their sessions. – KIKO Software Commented Mar 13 at 16:06
Add a comment  | 

1 Answer 1

Reset to default 2

I'm going to guess for each of your apps you'll need to configure the JAR hive variable.

https://fatfreeframework/3.9/quick-reference#JAR

JAR

Type: array

Default cookie parameters. Consists of the following options:

  • expire Unix timestamp, when the cookie should expire. Default: 0

  • path The path on the server in which the cookie will be available. Default: '/'

  • domain The domain that the cookie is available to. Default: $_SERVER['SERVER_NAME'] if available, else ''

  • secure Set the cookie when a secure HTTPS connection exists. Default: $_SERVER['HTTPS']=='on'

  • httponly Make the cookie accessible only through the HTTP protocol. Default: TRUE

You can refer to session_set_cookie_params() in the PHP Manual for more information.

You can also watch a video that goes over using cookies in the Fat-Free Framework.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论