问题:
Whoops, looks like something went wrong.
1/1
TokenMismatchException in VerifyCsrfToken.php line 46:
解决方法:
这是需要Token验证的,一般用laravel自动生成的form表单就会有token的。除此之外,还有有两种办法可以解决(其实第二种跟这种本质是一样的):
一、关闭token验证,具体问度娘,一堆。
二、在页面中加入token,我在jquery的ajax中是这么用的:
$.ajax({
type: "PUT",
url: urls,
data:'',
dataType: "json",
headers: {
'X-CSRF-Token': $('meta[name="_token"]').attr('content')
},
async:true,
cache:false,
success: function (msg) {
if(msg.status){
//$('body').message({'content':'订单取消成功'});
location.reload();
}else{
$('body').message({'content':msg.message});
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
if (XMLHttpRequest.status==403 && XMLHttpRequest.responseText=='UserNotLogin'){
$('body').login();
}
}
}); //end ajax
其中的headers: {
'X-CSRF-Token': $('meta[name="_token"]').attr('content')
},
部分就是用来添加token的。
Author:leedaning
本文地址:http://blog.csdn.net/leedaning/article/details/46927629