我已经constants.php在Silex中使用composer自动加载了文件。constants.php<?phpdefine('SENT_SUCCESS_','Chat Transcript has been successfully sent');define('INVALID_CASE_NUMBER','Invalid Case Number');define('INVALID_FILE_EXTENSIONS','Following attachment(s) couldn\'t be uploaded with this chat due to an Invalid Extensions');?>我想index.html.twig在js<script />标记的文件中访问它。我们可以轻松地在js中使用php变量,但是我不知道如何使用php常量。我尝试了这个,但是没有在工作index.html.twig。<script>const INVALID = '{{INVALID_FILE_EXTENSIONS}}';</script>任何人都有主意,如何获取此变量?
- 1 回答
- 0 关注
- 217 浏览
添加回答
举报
0/150
提交
取消