Smarty 仅在调试是 ACITVE 时才显示变量


smarty shows variable only if debug is acitve

我有以下聪明的模板:

  <div class="col-md-4 col-sm-4 col-lg-4 col-xs-12 col-md-offset-4 col-lg-offset-4 col-sm-offset-4 login-box">
{$validation_errors}
    <p class="heading">Please Log In!</p>
    {form url='user/login'}
        <div class="form-group">
            <label for="Email">Email address</label>
            <input type="text" class="form-control" id="Email" placeholder="Enter email" name="email" />
        </div>
        <div class="form-group">
            <label for="Password">Email address</label>
            <input type="password" class="form-control" id="Password" placeholder="Enter password" name="password" />
        </div>
        <button type="submit" class="btn btn-success pull-right">Submit</button>
    {form}
</div>

这是要分配$validation_errors的 PHP 代码:

$this->smartyci->assign('validation_errors', $error);

所以我现在的问题是,如果我像这样将 smarty 设置为调试模式,$validation_errors才会显示在模板中:

<div class="col-md-4 col-sm-4 col-lg-4 col-xs-12 col-md-offset-4 col-lg-offset-4 col-sm-offset-4 login-box">
{debug}
{$validation_errors}
    <p class="heading">Please Log In!</p>
    {form url='user/login'}
        <div class="form-group">
            <label for="Email">Email address</label>
            <input type="text" class="form-control" id="Email" placeholder="Enter email" name="email" />
        </div>
        <div class="form-group">
            <label for="Password">Email address</label>
            <input type="password" class="form-control" id="Password" placeholder="Enter password" name="password" />
        </div>
        <button type="submit" class="btn btn-success pull-right">Submit</button>
    {form}
</div>

我现在真的知道为什么只有当我在模板中放置 {debug} 时才显示变量。顺便说一句,任何其他变量都工作正常。

不知何故,$validation_errors 变量受到了智能缓存的影响。我已经禁用了追逐,现在一切正常。