Symfony Twig文件中的Jquery文件上载程序不工作
我正在使用这段代码作为jquery文件上传程序,我在这段代码中找到了一些lib文件,我已经包含了这些文件,但在我的twig文件中仍然出现了错误 Lib文件是:tmpl.min.js 错误-:第1行的“;”和意外字符未关闭Symfony Twig文件中的Jquery文件上载程序不工作,symfony,Symfony,我正在使用这段代码作为jquery文件上传程序,我在这段代码中找到了一些lib文件,我已经包含了这些文件,但在我的twig文件中仍然出现了错误 Lib文件是:tmpl.min.js 错误-:第1行的“;”和意外字符未关闭 <script id="template-upload" type="text/x-tmpl"> Line 1: {% for (var i=0,file; file=o.files[i]; i++) { %} <
<script id="template-upload" type="text/x-tmpl">
Line 1: {% for (var i=0,file; file=o.files[i]; i++) { %}
<tr class="template-upload fade">
<td>
<span class="preview"></span>
</td>
<td>
<p class="name">{%=file.name%}</p>
{% if (file.error) { %}
<div>
<span class="label label-danger">Error</span> {%=file.error%} </div>
{% } %}
</td>
<td>
<p class="size">{%=o.formatFileSize(file.size)%}</p>
{% if (!o.files.error) { %}
<div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">
<div class="progress-bar progress-bar-success" style="width:0%;"> </div>
</div>
{% } %}
</td>
<td>
{% if (!o.files.error && !i && !o.options.autoUpload) { %}
<button class="btn blue start btn-sm">
<i class="fa fa-upload"></i>
<span>Start</span>
</button>
{% } %}
{% if (!i) { %}
<button class="btn red cancel btn-sm">
<i class="fa fa-ban"></i>
<span>Cancel</span>
</button>
{% } %}
</td>
</tr>
{% } %}
</script>
第1行:{%for(vari=0,file;file=o.files[i];i++){%}
{%=file.name%}
{%if(file.error){%}
错误{%=file.Error%}
{% } %}
{%=o.formatFileSize(file.size)%}
{%if(!o.files.error){%}
{% } %}
{%if(!o.files.error&&!i&&!o.options.autoUpload){%}
开始
{% } %}
{%if(!i){%}
取消
{% } %}
{% } %}
有谁能帮我一下那个确切的错误是什么。我无法理解。错误是因为模板语法冲突。您的javaScript模板库使用相同的
{%%}
代码块
您可以告诉twig不要使用
快乐编码 现在浏览过的文件并没有用post方法发布到服务器端。您能建议什么是colud吗problem@user3458514:在这种情况下,或者有这么多信息,我无法为您的新(!)问题提出任何解决方案。我肯定你们并没有告诉我,在你们解决问题之前,文件已经发布在服务器端了!您可以针对您的问题提出另一个问题,并提供适当的代码示例/错误描述。我相信有一个具有专业知识的人能够帮助你。从你的个人资料中可以看出,你是stackoverflow的新手。请花点时间来看看。还有。你为什么把第一行javascript放在
{%%}
里面?或者你想让它变成一个细枝环?
{% verbatim %}
Put your js template script here
{% endverbatim %}