你走了好,不然总担心你要走。
### 实验环境
- laravel 5.1
实验步骤
1
| composer require rcrowe/twigbridge
|
1 2 3 4 5 6 7 8
| 'providers' => [ ... TwigBridge\ServiceProvider::class, ], 'aliases' => [ ... 'Twig' => TwigBridge\Facade\Twig::class, ],
|
- 3.发布配置文件,该操作会在config目录下新建一个专属twig的配置文件twigbrage.php
1
| php artisan vendor:publish --provider="TwigBridge\ServiceProvider"
|
1 2 3 4 5 6 7 8 9 10 11
| Route::get('test',function (){ $users = \App\User::all(); return view('hello',compact('users')); });
<body> {% for user in users %} {{ user.name }} {% endfor %} </body>
|
参考
https://packagist.org/packages/rcrowe/twigbridge