1、适用于 ajax和普通的http请求

2、vue添加用法如下:

<script type="text/javascript src="/dist/js/app.min.js">
<script type="text/javascript>
Vue.http.interceptors.push(function(request, next) {

            // modify headers
            request.headers.set('X-CSRF-TOKEN', '{{ csrf_token() }}');

            // continue to next interceptor
            next();
        });
</script>

 

相关文章: