Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/270.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 正在将Laravel POST方法作为GET方法发送。代码405_Php_Laravel_Http Status Code 405 - Fatal编程技术网

Php 正在将Laravel POST方法作为GET方法发送。代码405

Php 正在将Laravel POST方法作为GET方法发送。代码405,php,laravel,http-status-code-405,Php,Laravel,Http Status Code 405,所以我已经看过了与我的问题相关的答案。 我有一个laravel应用程序,它在本地主机服务器上运行得非常好。那里的线路运行良好。但当我在共享主机上上传我的laravel应用程序时,只有GET方法起作用。当我尝试使用任何POST请求(例如登录到我的应用程序)时,它会发送405个错误代码。 例如,我将向您展示登录时出现的问题 这是路线 Route::post('authinticate',['as'=>'authinticate','uses'=>'LoginController@auth

所以我已经看过了与我的问题相关的答案。 我有一个laravel应用程序,它在本地主机服务器上运行得非常好。那里的线路运行良好。但当我在共享主机上上传我的laravel应用程序时,只有GET方法起作用。当我尝试使用任何POST请求(例如登录到我的应用程序)时,它会发送405个错误代码。 例如,我将向您展示登录时出现的问题

这是路线

Route::post('authinticate',['as'=>'authinticate','uses'=>'LoginController@authenticate']);
控制器功能

public function authenticate(LoginRequest $request)
    { //$credentials = $request->only('user_name', 'password');

        $credentials = array(
            'user_name' => $request->input('username'),
             'password' => $request->input('password'),
            );


        if (Auth::attempt($credentials)) {
            // Authentication passed...
            return redirect()->route('home');
        }
        else{
            return redirect()->back()->withErrors(['message' => 'اسم المستخدم او كلمة المرور غير صحيحين.']);
        }
    }
HTML格式:

<form method="POST" action="{{ route('authinticate') }}">
                @csrf

                    <div class="form-group signIn">
                        <label for="username">اسم المستخدم</label>
                        <input type="text" name="username" placeholder="اسم المستخدم" class="form-control" id="username" value="{{ old('user_name') }}">
                    </div>
                    <div class="form-group">
                        <label for="password">كلمة المرور</label>
                        <input type="password" name="password" placeholder="كلمة المرور" class="form-control" id="password">
                        <p></p>
                        <a href="{{ route('forgot') }}" >نسيت كلمة المرور</a>
                    </div>
                    <input type="submit" class="btn btn-block btn-default btn-success" name="submit" id="submit" value="دخـــول">
                </form>
这是在提交之后。


检查标题,将POST请求发送到
http://www.aouacc.net/aunthinticate
返回一个
301
标题,该标题触发重定向到https版本。因为显然您没有在代码中设置重定向,所以它可能是在服务器级别设置的。更改路线,使其使用
https://www.aouacc.net
而不是
http://www.aouacc.net

检查标题,将POST请求发送到
http://www.aouacc.net/aunthinticate
返回一个
301
标题,该标题触发重定向到https版本。因为显然您没有在代码中设置重定向,所以它可能是在服务器级别设置的。更改路线,使其使用
https://www.aouacc.net
而不是
http://www.aouacc.net

您能出示您的
主页
路线和控制器吗?你能登录你的
身份验证
函数以确保它1)命中该函数,2)它将重定向到哪个方向吗?你能显示你的
主路径和控制器吗?你能登录你的
authenticate
函数以确保它1)命中函数2)重定向到哪个方向吗?好的,但我该怎么做呢?我忘了提到我正在使用cloudflare,也许它传递了一些导致问题的东西?检查你的cloudflare配置,有一条规则可以自动将所有
http
请求重定向到
https
。我认为选项是“自动HTTPS重写”。如果您确实想使用https,那么您需要在所有规则中强制使用它。检查这里的答案:看看怎么做。好吧,但是我怎么做呢?我忘了提到我正在使用cloudflare,可能是它传递了一些导致问题的东西?检查您的cloudflare配置,有一条规则可以自动将所有
http
请求重定向到
https
。我认为选项是“自动HTTPS重写”。如果您确实想使用https,那么您需要在所有规则中强制使用它。检查这里的答案:看看如何做到这一点。
Mixed Content: The page at 'https://www.aouacc.net/login' was loaded over a secure connection, but contains a form that targets an insecure endpoint 'http://www.aouacc.net/authinticate'. This endpoint should be made available over a secure connection.