Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am running a laravel 4 framework and I get a Whoops! error with just the message "_token" when I try to update an instance of an eloquent model class. What does this mean? I use Form::model to create the form and I am able to update records of other model classes.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
284 views
Welcome To Ask or Share your Answers For Others

1 Answer

This is usually a result of either a missing or mismatched CSRF token. If you haven't placed a token in your form, do so by echoing the function 'Form::token()' somewhere inside your form. Otherwise I believe this is handled for you if you use the 'Form::open()' syntax to open your form. You can learn more about it here: http://laravel.com/docs/html#csrf-protection

The token is stored as part of the user's session, btw, so it's possible you can get a token mismatch error if you store your sessions in the database, then wipe the database in between getting a form and posting it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...