Lucius
V2EX  ›  问与答

smarty中 {$smarty.cookies.cookie} 怎么传递变量参数呢?

  •  
  •   Lucius · Jan 4, 2014 · 2385 views
    This topic created in 4524 days ago, the information mentioned may be changed or developed.
    {$smarty.cookies.cookie} 这样是可以的 但是

    {$cookie|cat:'cookie' } {$smarty.cookies.$cookie} dosen't work :(
    Supplement 1  ·  Jan 4, 2014
    解决了 使用

    {assign var="cookie" value=$cookie} 声明模板变量

    再用

    {php}
    $cookiename = $this->get_template_vars('cookie');
    echo $_COOKIE[$cookie];
    {/php}

    获取到cookie 不知有没有更好的办法
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1765 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 16:15 · PVG 00:15 · LAX 09:15 · JFK 12:15
    ♥ Do have faith in what you're doing.