我需要html作为字符串。而且我喜欢使用刀片引擎来存储和呈现html。
此html字符串将其转换为PDF。
此刻,我有刀片流作为对浏览器的响应。
return view('users.edit', compact('user'));
如何从刀片模板中获取html文本?
谢谢。
答案 0 :(得分:21)
答案 1 :(得分:0)
<!-- View stored in resources/views/greeting.blade.php -->
<html>
<body>
<h1>Hello, {{ $name }}</h1>
</body>
</html>
<!-- In your php controller -->
return view('greeting', ['name' => 'James']);