首页 > 解决方案 > PHP 杠杆 FatalErrorException

问题描述

我正在学习 php 杠杆。我想将记录插入 mysql 数据库。一段时间后,我收到以下错误。

(1/1) FatalErrorException 在 HandleExceptions.php 第 57 行中超过了 60 秒的最大执行时间

这是控制器的代码。

    <?php

    namespace App\Http\Controllers;

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

    class StudInsertController extends Controller {
       public function insertform() {
          return view('stud_create');
       }

       public function insert(Request $request) {
          $name = $request->input('stud_name');
          DB::insert('insert into student (name) values(?)',[$name]);
          echo "Record inserted successfully.<br/>";
          echo '<a href = "/insert">Click Here</a> to go back.';
      }
}

这是html代码。

<html>
   <head>
      <title>Student Management | Add</title>
   </head>

   <body>
      <form action = "/create" method = "post">
         <input type = "hidden" name = "_token" value = "<?php echo csrf_token(); ?>">
         <table>
            <tr>
               <td>Name</td>
               <td><input type='text' name='stud_name' /></td>
            </tr>
            <tr>
               <td colspan = '2'>
                  <input type = 'submit' value = "Add student"/>
               </td>
            </tr>
         </table>
      </form>

   </body>
</html>

这是路线..

Route::get('insert','StudInsertController@insertform');
Route::post('create','StudInsertController@insert');

我还尝试更改 php.ini-development 文件中的限制

 Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 300

这是错误的屏幕截图.. 在此处输入图像描述

标签: php

解决方案


推荐阅读