Php会话用户名Presatashop

Php会话用户名Presatashop,php,session,cookies,prestashop,Php,Session,Cookies,Prestashop,登录到我的网站后,登录页面会显示用户名,但返回主页后会再次显示签名。只有标签有问题,所有其他功能(如购物、搜索所有其他内容)都可以正常工作。ie.与用户已登录相同。将显示“登录”标签,而不是“注销” 同样,当用户注销时,它显示用户名,但用户不能做任何事情,如购物、查看帐户详细信息等,即与用户注销时相同。但显示的是“用户名”而不是“登录”标签。 我用的是prestashop。这只发生在登录页面和主页上 <!-- Block user information module NAV -->

登录到我的网站后,登录页面会显示用户名,但返回主页后会再次显示签名。只有标签有问题,所有其他功能(如购物、搜索所有其他内容)都可以正常工作。ie.与用户已登录相同。将显示“登录”标签,而不是“注销”

同样,当用户注销时,它显示用户名,但用户不能做任何事情,如购物、查看帐户详细信息等,即与用户注销时相同。但显示的是“用户名”而不是“登录”标签。 我用的是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 -->

{如果$logged}
{/if}
{如果$logged}
{else}
{/if}
试试这段代码

 {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>
{if$logged}
{/if}
{如果!$logged}
{else}
{/if}

将此添加到.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>

标题未设置Etag
标题集缓存控制“最大年龄=0,无缓存,无存储,必须重新验证”
标题集Pragma“无缓存”
标题集过期“1984年1月11日星期三05:00:00 GMT”

yes,,有时在已登录时显示为“登录”&即使在注销后也显示为“注销”和“用户名”。在刷新时,它会起作用。