Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 发送请求和接收阵列_Php_Arrays_Laravel - Fatal编程技术网

Php 发送请求和接收阵列

Php 发送请求和接收阵列,php,arrays,laravel,Php,Arrays,Laravel,当我寄出表格时,我会得到那一页 The page has expired due to inactivity. Please refresh and try again. 我如何解决这个问题,这样当我点击提交按钮时,我就不会掉到那里,而只是更新页面 The page has expired due to inactivity. Please refresh and try again. 其次,也是最重要的,在以表单形式提交数据后,我得到一个空数组,为什么?也就是说,按下submit按

当我寄出表格时,我会得到那一页

The page has expired due to inactivity. 

Please refresh and try again.
我如何解决这个问题,这样当我点击提交按钮时,我就不会掉到那里,而只是更新页面

The page has expired due to inactivity. 

Please refresh and try again.
其次,也是最重要的,在以表单形式提交数据后,我得到一个空数组,为什么?也就是说,按下submit按钮后,我将其放在我在顶部描述的页面上<代码>由于不活动,页面已过期。在
退格后
如果按Ctrl+u,则在页面顶部可以看到此代码

Array
(
) 
为什么数组是空的?请告诉我怎么修

这是我的模板contact.blade.php

@extends ("default.layouts.layout")

@section("content")
<div style="display: flex;">
    <form method="post" action="{{ route ('contact') }}">
        <label for="name">Name</label>
        <input name="name" type="text" >
        <label for="e-mail">E-mail adress</label>
        <input  name="e-mail" type="text">
        <label for="site">Site</label>
        <input name="site" type="text" style="margin-bottom: 10px;" >

        <label for="text">Text</label>
        <textarea name="text"></textarea>
        <button style="background-color:lightslategrey" type="submit">Submit</button>
    </form>
</div>
<style>
    input {
        display: flex;
    }
</style>
@endsection
@extends(“default.layouts.layout”)
@第节(“内容”)
名称
电子邮件地址
场地
正文
提交
输入{
显示器:flex;
}
@端部
这是我的控制器ContactController

<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class ContactController extends Controller
{




    public function show(Request $request){

        print_r($request->all());

        return view("default.contact",["title"=>"Contacts"]);
    }
}

来修复以下错误

由于不活动,该页已过期

请刷新并重试

{{csrf_field()}}
添加到表单中

<form method="post" action="{{ route ('contact') }}">
    {{ csrf_field() }}
...
</form>

{{csrf_field()}}
...

修复以下错误

由于不活动,该页已过期

请刷新并重试

{{csrf_field()}}
添加到表单中

<form method="post" action="{{ route ('contact') }}">
    {{ csrf_field() }}
...
</form>

{{csrf_field()}}
...

一个问题是您的表单上没有CSRF令牌。Laravel在每次执行请求时都需要CSRF令牌,否则它只会出错

将此添加到您的表单中,看看是否有帮助

{{ csrf_field() }}

其中一个问题是,您的表单上没有CSRF令牌。Laravel在每次执行请求时都需要CSRF令牌,否则它只会出错

将此添加到您的表单中,看看是否有帮助

{{ csrf_field() }}