laravel提交表单报:419 unknown status错误
<formmethod="POST"action="/register"> <TextField name="name"label="用户名"onChange={event => this.setState({name: event.target.value})} value={this.state.name} fullWidthmargin="normal"/> <TextField name="email"label="邮箱或手机号"onChange={event => this.setState({email: event.target.value})} value={this.state.email} fullWidthmargin="normal"/> <TextField name="password"label="密码"type="password"onChange={event => this.setState({password: event.target.value})} value={this.state.password} fullWidthmargin="normal"/> <TextField name="password_confirmation"label="确认密码"type="password"onChange={event => this.setState({password_confirmation: event.target.value})} value={this.state.password_confirmation} fullWidthmargin="normal"/> <Button raisedcolor="primary"type="submit">注册</Button> </form>
这个是 csrf token
判断而来的错误
-
你可以在
App\Http\Middleware\VerifyCsrfToken
中设置取消CSRF 验证,当然这是不推荐的。protected$except= ['*'];
-
表单提交/AJAX请求的时候带上
csrf token
信息, 参考Laravel中Ajax调用时的CSRF对策