简体   繁体   English

该页面因不活动而过期。 请刷新,然后重试

[英]The page has expired due to inactivity. Please refresh and try again

I am using laravel 5.5 when ever i send data in post request to my controller . 每当我将后请求中的数据发送到控制器时,我就使用laravel 5.5。 It always show the following message The page has expired due to inactivity. 它始终显示以下消息该页面由于不活动而过期。

Please refresh and try again. 请刷新,然后重试。 my view code is : 我的查看代码是:

@extends('layouts.app')
@section('content')


    <!DOCTYPE html>
    <html>
    <head>
        <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
        <title></title>
    </head>
    <body>
    <div class="span3 well">
          <legend>Create Your New Task!</legend>
          <div class="form-group">
            <div class="col-md-4">  
             <form accept-charset="UTF-8" action="/add-task" class="form-horizontal" method="post">
            <input class="form-control"   name="name" placeholder="Task Name" type="text"> 
            <input class="form-control"  name="assignedto" placeholder="Assigned To" type="text">
            <input class="form-control"  name="deadline" placeholder="DeadLine" type="text"> 
            <button class="btn btn-warning" type="submit">Add Task</button>
            {{csrf_field()}}
        </form>
        </div>
    </div>
    </div>
    </body>

    </html>

    @endsection()

and my controller is : 我的控制器是:

<?php

    namespace App\Http\Controllers;

    use Illuminate\Http\Request;
    use Illuminate\Support\Facades\DB;
    use App\task;

    class AddTask extends Controller
    {
        public function insertTask(Request $req)
        {
            $name=new task();
            $name->name=$req['name'];
            $name->assigned_to=$req['assignedto'];
            $name->deadline=$req['deadline'];

            $name->save();

        }
    }

i doen't know what is the solution 我不知道该怎么解决

I had the same problem using localhost:8000 Try below steps 我在使用localhost:8000遇到了相同的问题,请尝试以下步骤
1.Try on clean browser. 1.尝试使用干净的浏览器。 It seems that the problem is with cookies from development with previous Laravel versions, on the same url. 似乎问题出在同一URL上,使用以前的Laravel版本开发的cookie。
2.Try to add {{ csrf_field() }} below opening form tag 2. {{ csrf_field() }}在打开表单标签下面添加{{ csrf_field() }}

<form action="/add-task" method="POST">
  {{ csrf_field() }}

3.and remove the accept-charset="UTF-8" 3.然后删除accept-charset="UTF-8"

further reading Similiar Post 1 and Similiar Post2 进一步阅读Similiar Post 1Similiar Post2
additional link about laravel 5.5 errors Larave 5.5: default error views and costomizing them 有关laravel 5.5错误的附加链接Larave 5.5:默认错误视图并对其进行规范化

Pay attention on php.ini mbstring.func_overload parameter. 注意php.ini mbstring.func_overload参数。

It has to be set to 0. And mbstring.internal_encoding set to UTF-8 . 它必须被设置为0mbstring.internal_encoding设置为UTF-8。 In my case that was a problem. 就我而言,这是一个问题。

Had to put <input type="hidden" name="_token" value="{{ csrf_token() }}"> or use @csrf in Laravel 5.6 inside form. 必须将<input type="hidden" name="_token" value="{{ csrf_token() }}">放在表格中或在Laravel 5.6中使用@csrf {{csrf_token()}} otherwise would be printed in html page {{csrf_token()}}否则将打印在html页面中

had the same problem but /storage/framework/sessions folder was missing. 有同样的问题,但是/ storage / framework / sessions文件夹丢失了。 Created the folder and that fixed it after a refresh. 创建了文件夹,并在刷新后对其进行了修复。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 提交表单时 Laravel 返回“页面因不活动而过期。请刷新并重试。” - When submitting a form Laravel returns "The page has expired due to inactivity. Please refresh and try again." 该页面因不活动而过期。 请刷新,然后重试。 Laravel 5.5生产 - The page has expired due to inactivity. Please refresh and try again. Laravel 5.5 Production laravel 5.5 由于不活动,页面已过期。 请刷新并重试 - laravel 5.5 The page has expired due to inactivity. Please refresh and try again 登录responsinator.com时出现“页面因不活动而过期。请刷新并重试” - "The page has expired due to inactivity. Please refresh and try again" when login in responsinator.com 由于不活动,页面已过期。 请刷新并重试。 “在我登录后在我的生产托管 cpanel 中”laravel 5.5 - The page has expired due to inactivity. Please refresh and try again. "in my production hosting cpanel after i login" laravel 5.5 该页面因不活动而已过期。请刷新并在“登录”中重试 - The page has expired due to inactivity.Please refresh and try again in Login Laravel 5.5 登录和注册页面说:由于不活动,页面已过期。[TokenMismatchException] - Laravel 5.5 login and register page says:The page has expired due to inactivity.[TokenMismatchException] 为什么我的API上显示“该页面已由于不活动而过期。”? - Why am I getting “The page has expired due to inactivity.” on my API? “由于不活动,页面已过期” - Laravel 5.5 - “The page has expired due to inactivity” - Laravel 5.5 Laravel 5.5页面由于不活动而过期 - Laravel 5.5 The page has expired due to inactivity
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM