我在 Laravel 中使用 Mail 庫來發(fā)送帶有傳遞給刀片視圖的自定義數(shù)據(jù)的 html 電子郵件。當郵件必須呈現(xiàn)從數(shù)據(jù)庫中的一行獲取的 html 時產(chǎn)生的問題,其中包括我通過視圖傳遞的變量。這是我的可郵寄類中的構(gòu)建函數(shù)public function build(){ return $this->from('hello@test.it') ->view('view') ->with([ 'url' => 'https://google.com', 'text' => $this->parameters->text, ]);}然后在刀片視圖中:<div> {!! $text !!}</div>這是 $text 變量的樣子:<p> <span>This is my text for the mail</span> <a href="{{ $url }}">Click here to compile</a></p>鏈接 href 應包含 url 變量值,而不是不傳遞變量名本身
在郵件刀片視圖中的另一個變量中使用變量
慕田峪9158850
2021-11-05 13:16:42