Laravel - 什么是香草 PHP
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36911838/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel - what means Vanilla PHP
提问by Artur Mamedov
In the Laravel documentation, on route caption, at point where explain how to create csrf token, the doc says:
在 Laravel 文档中,关于路线标题,在解释如何创建 csrf 令牌的地方,文档说:
// Vanilla PHP
<?php echo csrf_field(); ?>
// Blade Template Syntax
{{ csrf_field() }}
What it mean for Vanilla PHP? Thank in advance! :)
这对香草 PHP 意味着什么?预先感谢!:)
Link to the doc https://laravel.com/docs/5.2/routing#csrf-protection
回答by CmdrSharp
What it means is that you're echoing the method they've created in Vanilla PHP - thus, standard PHP. Below it, you'll see the {{ csrf_field() }}
which is the Blade syntax provided with Laravel. It simply presents you with two ways to output the same thing - one in "Vanilla", and one with Blade!
这意味着您正在响应他们在 Vanilla PHP 中创建的方法 - 因此,标准 PHP。在它下面,你会看到{{ csrf_field() }}
Laravel 提供的 Blade 语法。它只是为您提供了两种输出相同内容的方法 - 一种在“Vanilla”中,一种在 Blade 中!