欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

请问 提取 blade.php 的内容过来赋给变量 而不输出 用什么方法 一种类似于smarty->fetch的方法 怎么实现 有大用

shiping1 的头像
谷歌 laravel view to string
laravel view to html
laravel view to variable
laravel view to view
laravel view to json


laravel 4


$view = View::make('my_view', ['name' => 'Rishabh']);
$contents
= (string) $view;
// 或者
$contents = $view->render();

$html = (string) View::make('foo', ['bar' => 'baz']);
// Use render() method instead.
//Your exception will not be "hidden" by __toStrings()'s

// exception restriction.
$html = View::make('foo', ['bar' => 'baz'])->render();



laravel 5


$view = view('my_view', ['name' => 'Rishabh']);
$contents
= (string) $view;
// 或者
$contents = $view->render();

$html = (string) view('foo', ['bar' => 'baz']);
// Use render() method instead.
//Your exception will not be "hidden" by __toStrings()'s

// exception restriction.
$html = view('foo', ['bar' => 'baz'])->render();






laravel 4
[php]
$nav_primary_data = json_decode(file_get_contents('navs/primary.json', true);
$view_string = View::make('layouts.master.navs.primary')->with('nav_primary_data', $data)->render();
[/php]
laravel 5
$nav_primary_data = json_decode(file_get_contents('navs/primary.json', true);
$view_string = view('layouts.master.navs.primary')->with('nav_primary_data', $data)->render();

普通分类: