最大执行时间30秒超过了Laravel 4错误 [英] Maximum execution time of 30 seconds exceeded Laravel 4 error

查看:591
本文介绍了最大执行时间30秒超过了Laravel 4错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用laravel 4中的UserController发送密码请求的某个函数时遇到了问题。它检查电子邮件是否存在于数据库中,然后发送电子邮件(如果用户有)。然后该函数在表中创建一个标记并将其发送到电子邮件中链接的末尾。

I am having an issue with a certain function that sends a password request within my UserController in laravel 4. It checks to see if the email exists in the database then sends an email if the user does. The function then creates a token in a table and sends that at the end of the link within the email.

该函数可以像在数据库中创建标记一样工作,但它似乎有问题,因为我不断收到最大执行时间错误。我不知道是什么造成这种情况,这似乎与重定向有关。有人可以帮帮我吗?提前感谢!

The function works as for as creating the token in the database but it seems to have an issue because i keep getting the Maximum execution time error. I do not know what is causing this, it seems to have something to do with the redirect. Can someone please help me? Thanks in advance!

以下是控制器功能:

Here is the controller function:

public function passwordRequest()
    {
        $data = [
            "requested"=>Input::old("requested")
        ];

        if(Input::server("REQUEST_METHOD") == "POST") {

            $input = Input::all();
            $rules = [
                "email" => "required|exists:users,email"
            ];
            $v = Validator::make($input, $rules);

            if($v->passes()) {
                $credentials = [
                    "email" => Input::get("email"),
                ];

                Password::remind($credentials, function($message, $user) {
                    $message->from("request@test.com");
                });

                $data["requested"] = true;

                return Redirect::route("user/request")->with($data);
            }

            return Redirect::to(URL::route("user/request"))->withInput($data)->withErrors($v);
        }

        return View::make("user/request", $data);
    }

这里是routes.php文件:

here is the routes.php file:

Route::group(["before"=>"guest"], function() {
    Route::any("/", [
        "as"=>"user/login",
        "uses"=>"UserController@userLogin"
    ]);

    Route::any("/request", [
        "as"=>"user/request",
        "uses"=>"UserController@passwordRequest"
    ]);

    Route::any("/reset", [
        "as"=>"user/reset",
        "uses"=>"UserController@passwordReset"
    ]);

    Route::any("/register", [
        "as" => "user/register", 
        "uses" => "UserController@userRegister"
    ]);
})

;

这里是需要的视图:

here is the view if needed:

@extends("layouts.master")

@section("content")
<h1>Request Password Reset</h1>

{{ Form::open([
    "route"=>"user/request",
    "autocomplete"=>"off"
]) }}

    @if(isset($errors))
        @foreach ($errors->all() as $error)
            <div class="error">
                <li>{{ $error }}</li>
            </div>
        @endforeach
    @endif

    @if(Session::has("requested"))
        <div class="success">
            <li>An email has been sent with your password reset request.</li>
        </div>
        {{ Session::forget('requested') }}
    @endif
    <br />
    {{ Form::label("email", "Email:") }}
    {{ Form::text("email", Input::old("email"), [
        "placeholder"=>"Email Address"
    ]) }}

    {{ Form::submit("Reset") }}

{{ Form::close() }}
<br />
{{ HTML::linkRoute("user/login", "Return to Login") }}
@stop


推荐答案

问题出在我使用的wifi上。我断开了连接,并连接到另一个,一切正常。我从来没有遇到这个问题,一个WiFi不会让本地主机发送电子邮件。感谢所有的帮助!

The problem was actually in the wifi I was using. I dissconnected from it and connected to another one and everything worked just fine. I have never had this issue where a wifi will not let the localhost send an email. Thanks for all the help!

这篇关于最大执行时间30秒超过了Laravel 4错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆