laravel 语法错误,意外的“资产”(T_STRING)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29289602/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 11:14:02  来源:igfitidea点击:

laravel syntax error, unexpected 'assets' (T_STRING)

phplaravellaravel-4

提问by MZH

I'm trying to load laravel project but getting error below

我正在尝试加载 Laravel 项目,但在下面出现错误

Symfony \ Component \ Debug \ Exception \ FatalErrorException
syntax error, unexpected 'assets' (T_STRING)

enter image description here

在此处输入图片说明

Its under views/myview.blade.php, I don't understand why its throwing error on assets, here is my view code

它在 views/myview.blade.php 下,我不明白为什么它在资产上抛出错误,这是我的视图代码

<video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="1000" height="563"
          poster="{{ asset('assets/public/video/video.png')}}"
          data-setup="{}">

When I change the path to somepath/public/video/video.png then error is unexpected 'somepath'. Any help will be greatly appreciated

当我将路径更改为 somepath/public/video/video.png 时,错误是意外的“somepath”。任何帮助将不胜感激

回答by mopo922

You're missing a closing single-quote on this line:

您在此行上缺少一个结束单引号:

videojs.options.flash.swf = "<?php echo asset('assets/js/plugins/video-js/video-js.swf); ?>";

So by the time you get to line 29, you're actually closing the string you started there, and the next thing is assets.

因此,当您到达第 29 行时,您实际上正在关闭从那里开始的字符串,接下来是assets.