【问题标题】:CakePHP: change Js Helper setVariableCakePHP:更改 Js 助手 setVariable
【发布时间】:2014-10-28 23:11:01
【问题描述】:

如何更改设置,例如CakePHP 的 Js Helper 的变量? 我会这样说:

class AppController extends Controller {
  public $helpers = array('Js' => array('setVariable' => 'foo'));

但是没有效果。

echo $this->Js->writeBuffer(…); 在我的视图中仍然有这个输出:window.app = { … } 而不是:window.foo = { … }

我不知道出了什么问题:(

【问题讨论】:

    标签: javascript cakephp helper


    【解决方案1】:

    嗯,我自己解决了。我在调用echo $this->Js->writeBuffer(…);之前在我的视图中添加了$this->Js->setVariable = 'APP';

    【讨论】:

      猜你喜欢
      • 2012-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-21
      • 1970-01-01
      • 2011-12-16
      • 1970-01-01
      相关资源
      最近更新 更多