久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Laravel Blade 通過@include 傳遞帶有字符串的變量會導

Laravel Blade passing variable with string through @include causes error(Laravel Blade 通過@include 傳遞帶有字符串的變量會導致錯誤)
本文介紹了Laravel Blade 通過@include 傳遞帶有字符串的變量會導致錯誤的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

在 Laravel 5.0.27 中,我包含一個帶有變量和以下代碼的視圖:

In Laravel 5.0.27 I am including a view with with a variable and the following code:

@include('layouts.article', [
        'mainTitle' => "404, page not found",
        'mainContent' => "sorry, but the requested page does not exist :("
    ])

我收到以下錯誤...

FatalErrorException 語法...錯誤,意外的','

FatalErrorException syntax ... error, unexpected ','

我已經確定錯誤僅來自mainContent"變量字符串中的(",當我刪除("時,錯誤消失,一切正常.我在文檔中找不到任何內容在線列出的此錯誤或任何類似錯誤.

I've narrowed down that the error is solely from the "(" in the "mainContent" variable string, and when I remove the "(" the error disappears and everything runs fine. I can't find anything in documentation on this or any similar errors listed online.

有誰知道這是預期行為還是應該報告的錯誤?

Does anyone know if this is expected behavior or if this is a bug that should be reported?

非常感謝您的時間!

推薦答案

這不是 bug,而是由于正則表達式導致的 Blade 語法限制.解決方案來自 github:

It's not a bug but a limitation of blade syntax due to regex. Solution came from github:

問題是使用多行.您只能使用一行[傳遞變量] 在 Blade 中,因為語法受到 [通過常規表達]

The problem is using multi-line. You can only use a single line to [pass variables] in Blade, since syntax is limited [by regular expressions]

試試下面的代碼,你應該很高興:

Try the code below and you should be good to go:

@include('layouts.article', ['mainTitle' => "404, page not found", 'mainContent' => "sorry, but the requested page does not exist :("])

這篇關于Laravel Blade 通過@include 傳遞帶有字符串的變量會導致錯誤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Laravel Eloquent Union query(Laravel Eloquent Union 查詢)
Overwrite laravel 5 helper function(覆蓋 Laravel 5 輔助函數)
laravel querybuilder how to use like in wherein function(laravel querybuilder 如何在 where 函數中使用 like)
The Response content must be a string or object implementing __toString(), quot;booleanquot; given after move to psql(響應內容必須是實現 __toString()、“boolean和“boolean的字符串或對象.移動到 psql 后給出) - IT屋-程
Roles with laravel 5, how to allow only admin access to some root(Laravel 5 的角色,如何只允許管理員訪問某些根)
Laravel Auth - use md5 instead of the integrated Hash::make()(Laravel Auth - 使用 md5 而不是集成的 Hash::make())
主站蜘蛛池模板: 精品成人免费视频 | 99视频在线免费观看 | 欧美综合一区 | 一级黄色毛片子 | 91精品国产综合久久久久久首页 | 日本精品久久久久久久 | 成人精品国产一区二区4080 | av手机在线看 | 亚洲一区在线日韩在线深爱 | 久久免费精品 | 欧美极品在线 | 麻豆亚洲 | www.久| 在线观看成人小视频 | 欧美精品一区二区三区在线 | 亚洲欧美日韩在线 | 日本视频中文字幕 | 亚洲欧美一区二区三区国产精品 | 国产精品午夜电影 | 在线一区二区三区 | 亚洲视频欧美视频 | 成人国产a| 日本a在线 | 中文字幕在线精品 | 欧美一级免费观看 | 黄瓜av| 在线欧美小视频 | 一级黄片一级毛片 | 精品日韩 | 色婷婷av一区二区三区软件 | 国偷自产av一区二区三区 | 伊人久久在线 | 欧美成视频 | 国产欧美一区二区三区在线看蜜臀 | 国产视频一区二区三区四区五区 | 国产一区 | 欧美日韩国产精品一区 | 亚洲国产欧美一区 | 国产精久久久久久久妇剪断 | 天堂av影院 | 欧美精品一区三区 |