如何跨模块访问身份验证存储会话?

时间:2015-10-14 16:16:19

标签: php zend-framework2

我正在使用Zend Framework 2身份验证存储会话,基本上是用户模块和产品存储之间的customer_id。我需要根据customer_id展示产品。

这是代码

$userData_arr = $this->getServiceLocator()->get('user-auth-factory')->getStorage()->read();
 $customerID = $userData_arr->customer_id;

在上面我得到了用户模块控制器中的 customer_id ,它可以工作。但是当我想在产品模块控制器中访问相同的变量时,它是空的。这仅在实时服务器中发生。在我的localhost中,两个模块都能够获得customer_id

以下是我的服务器信息详情

> Registered serializer handlers    php php_binary
> Directive Local Value Master Value
> session.auto_start    Off Off
> session.cache_expire  180 180
> session.cache_limiter nocache nocache
> session.cookie_domain no value    no value
> session.cookie_httponly   Off Off
> session.cookie_lifetime   0   0
> session.cookie_path   /   /
> session.cookie_secure Off Off
> session.entropy_file  no value    no value
> session.entropy_length    0   0
> session.gc_divisor    100 100
> session.gc_maxlifetime    1440    1440
> session.gc_probability    1   1
> session.hash_bits_per_character   4   4
> session.hash_function 0   0
> session.name  PHPSESSID   PHPSESSID
> session.referer_check no value    no value
> session.save_handler  files   files
> session.save_path /tmp    /tmp
> session.serialize_handler php php
> session.upload_progress.cleanup   On  On
> session.upload_progress.enabled   On  On
> session.upload_progress.freq  1%  1%
> session.upload_progress.min_freq  1   1
> session.upload_progress.name
> PHP_SESSION_UPLOAD_PROGRESS
> session.upload_progress.prefix    upload_progress_    upload_progress_
> session.use_cookies   On  On
> session.use_trans_sid 0   0

以下是我的localhost配置

>     Session Support   enabled
>     Registered save handlers  files user
>     Registered serializer handlers    php_serialize php php_binary wddx
>     Directive Local Value Master Value
>     session.auto_start    Off Off
>     session.cache_expire  180 180
>     session.cache_limiter nocache nocache
>     session.cookie_domain no value    no value
>     session.cookie_httponly   Off Off
>     session.cookie_lifetime   0   0
>     session.cookie_path   /   /
>     session.cookie_secure Off Off
>     session.entropy_file  no value    no value
>     session.entropy_length    0   0
>     session.gc_divisor    1000    1000
>     session.gc_maxlifetime    1800    1800
>     session.gc_probability    1   1
>     session.hash_bits_per_character   5   5
>     session.hash_function 0   0
>     session.name  PHPSESSID   PHPSESSID
>     session.referer_check no value    no value
>     session.save_handler  files   files
>     session.save_path c:/wamp/tmp c:/wamp/tmp
>     session.serialize_handler php php
>     session.upload_progress.cleanup   On  On
>     session.upload_progress.enabled   On  On
>     session.upload_progress.freq  1%  1%
>     session.upload_progress.min_freq  1   1
>     session.upload_progress.name  
>     PHP_SESSION_UPLOAD_PROGRESS
>     session.upload_progress.prefix    upload_progress_    upload_progress_
>     session.use_cookies   On  On
>     session.use_only_cookies  On  On
>     session.use_strict_mode   Off Off
>     session.use_trans_sid 0   0

0 个答案:

没有答案