Php会话用户名Presatashop

时间:2016-04-02 11:01:58

标签: php session cookies prestashop

登录我的网站后,日志页面显示用户名称,但返回主页再次显示签名。只有标签是问题,所有其他功能,如购物,搜索其他一切正常。即。与用户登录时相同。'登录'标签显示而不是“退出”

同样,当用户注销时,它会显示用户名,但用户无法执行任何操作,例如购物,查看帐户详细信息等等,因为用户已注销。但用户名是'出现而不是“登录”'标签。 我正在使用prestashop。这只发生在登录页面和主页

<!-- Block user information module NAV  -->
{if $logged}
<div class="header_user_info">
    <a href="{$link->getPageLink('my-account', true)|escape:'html'}" title="{l s='View my customer account' mod='blockuserinfo'}" class="account" rel="nofollow"><span>{$cookie->customer_firstname} {$cookie->customer_lastname}</span></a>
</div>
{/if}
<div class="header_user_info">
    {if $logged}
        <a class="logout" href="{$link->getPageLink('index', true, NULL, "mylogout")|escape:'html'}" rel="nofollow" title="{l s='Log me out' mod='blockuserinfo'}">{l s='Sign out' mod='blockuserinfo'}</a>
    {else}
        <a class="login" href="{$link->getPageLink('my-account', true)|escape:'html'}" rel="nofollow" title="{l s='Log in to your customer account' mod='blockuserinfo'}">{l s='Sign in' mod='blockuserinfo'}</a>
    {/if}
</div>
<!-- /Block user information module NAV -->

2 个答案:

答案 0 :(得分:0)

试试此代码

 {if $logged}
    <div class="header_user_info">
        <a href="{$link->getPageLink('my-account', true)|escape:'html'}" title="{l s='View my customer account' mod='blockuserinfo'}" class="account" rel="nofollow"><span>{$cookie->customer_firstname} {$cookie->customer_lastname}</span></a>
    </div>
    {/if}
    <div class="header_user_info">
        {if !$logged}
            <a class="logout" href="{$link->getPageLink('index', true, NULL, "mylogout")|escape:'html'}" rel="nofollow" title="{l s='Log me out' mod='blockuserinfo'}">{l s='Sign out' mod='blockuserinfo'}</a>
        {else}
            <a class="login" href="{$link->getPageLink('my-account', true)|escape:'html'}" rel="nofollow" title="{l s='Log in to your customer account' mod='blockuserinfo'}">{l s='Sign in' mod='blockuserinfo'}</a>
        {/if}
    </div>

答案 1 :(得分:0)

在.htacces中添加这个解决了我的问题

<IfModule mod_headers.c>
    Header unset Etag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</IfModule>