Laravel Session:token 和 csrf_token 之间的区别

Difference between Laravel Session:token and csrf_token

csrf_token()

之间真的有区别吗
<input type="hidden" name="_token" value="{{ csrf_token() }}"/>

Session::token() ?

<input type="hidden" name="_token" value="{{ Session::token() }}" />

它们似乎产生相同的结果。

Laravel 提供了多种不同的方法来执行相同的任务。

第一个例子是辅助函数:https://laravel.com/docs/5.1/helpers

第二个例子是Session门面:https://laravel.com/docs/5.1/facades

结果没有区别,因为它们最终都会调用相同的方法。他们调用的实际方法是:https://laravel.com/api/5.1/Illuminate/Session/Store.html#method_token