php - smarty为什么报这个错?css中的错误也关模板引擎的事吗?

 手机用户2602881561 发布于 2022-11-14 06:49
Fatal error: Uncaught --> Smarty Compiler: Syntax error in template "file:F:\phpstudy\WWW\smartys\smarty\templates\intro.html" on line 12 "*{margin:0;padding:0;border:0;}" - Unexpected ":", expected one of: "}" <-- thrown in F:\phpstudy\WWW\smartys\smarty\libs\sysplugins\smarty_internal_templatecompilerbase.php on line 12

原来是因为smarty语法与css语法冲突,都有大括号,把css放到外部文件就好了

3 个回答
  • 是不是CSS样式的大括号和模板冲突,只要保证样式的大括号都折行就没问题

    2022-11-14 06:59 回答
  • 这应该是符号问题,你看看是不是有符号缺失或者中文状态的符号

    2022-11-14 06:59 回答
  • 建议用Smarty时,把界定符修改一下,因为还有可能和javascript冲突。
    之前做项目时都是修改为{% %}

    $smarty = new Smarty;
    $smarty->left_delimiter = '{%';
    $smarty->right_delimiter = '%}';

    http://www.smarty.net/docs/zh...

    2022-11-14 06:59 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有