不少站长升级苹果cms全新版后,模板出现致命错误: Undefined constant报错,老版本正常、新版本不能打开,关键缘由是:**新版苹果cms对标签语法,引号格式要求极其严格,不能在双引号内再使用双引号,中文/特殊字符务必规范包裹**。
错误写法(老版兼容,新版严格报错):
双引号嵌套双引号 + ,中文条件直接写在where内。引发PHP解析为非法常量,触发 Undefined constant 错误。
{maccms:vod num="8" paging="no" type="all" order="desc" by="hits" where="vod_area LIKE '%中国大陆%' OR vod_area LIKE '%国产%'"}prepreprepreprepreprepreprepreprepreprepre规则,外层单引号,内层双引号;严格遵守新版语法规范:
{maccms:vod num="8" paging="no" type="all" order="desc" by="hits" where='vod_area LIKE "%中国大陆%" OR vod_area LIKE "%国产%"'}prepreprepreprepreprepreprepreprepreprepre①where 总体用 单引号 ' ' 包裹
②内部条件值用 双引号 " " 包裹
③不得双引号嵌套双引号 """"
④不得不加引号直接写中文条件
只要是 vod、artactor 等标签出现类似报错;统一按这个格式修改:
{maccms:标签 num="数量" paging="no" type="分类" order="desc" by="排序" where='字段 LIKE "%内容%" OR 字段 LIKE "%内容%"'}prepreprepreprepreprepreprepreprepreprepre①新版苹果cms不兼容任何不规范引号;老版兼容写法所有要修正;
②修改完成后;进入后台 清除系统缓存 + 模板缓存;
③假如批量报错,可以批量替换模板里的 where 引号格式;
④条件中涵盖中文、特殊符号、空格,务必用引号严格包裹。
出现 Undefined constant 错误 = 标签语法不规范
解决方法:where 外层单引号;内层双引号,严格按照新版格式书写,修改后立即恢复正常。