Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嘿,我正在尝试使用 Knockout JS 。我对这个框架比较陌生。我使用 mootools 但发现淘汰赛很有趣而且很棒,所以刚开始玩,遇到了在 html 中使用 smarty 变量的问题。未捕获的 ReferenceError:无法解析绑定
Smarty 是服务器端,Knockout 是客户端。所以他们不能引起任何冲突。
它可能如下所示:
$smarty->assign('person', array('name' => 'John doe'));
还有你的模板:
<div data-bind="text: name"></div> <script>ko.applyBindings($person|@json_encode});</script>