Fatal error: Smarty error:syntax error: unrecognized tag
求助,代码如下,模板文件Login.tpl中,
<script><br />function create_code(){<br />	document.getElementByIdx_x("code").src = 'create_code.php?'+Math.random()*10000;<br />}<br /></script>
一直报错:“Fatal error: Smarty error: [in Login.tpl line 93]: syntax error: unrecognized tag: document.getElementByIdx_x("code").src = 'create_code.php?'+Math.random()*10000; (Smarty_Compiler.class.php, line 446) in I:\masterPHP\vtigercrm\Smarty\libs\Smarty.class.php on line 1095
”
求各位大神指导!!!
------解决方案--------------------
smarty 的 tpl 里面 要直接写 javascript 或 style 要用 literal 标签 包起来
例:
{literal}
<script>
function create_code(){
    document.getElementByIdx_x("code").src = 'create_code.php?'+Math.random()*10000;
}
</script>
{/literal} <div class="clear"></div>
                        
                        每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
                Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号