我有一个网页,上面有一个按钮,单击该按钮即可执行一个PHP函数.
当用户单击它时,需要51081ms才能返回页面.在我的Firefox开发人员工具中,“网络”选项卡将其中的51376毫秒归类为“等待”.
在我的PHP.ini文件中声明的max_execution_time为30.我在PHPinfo文件中也可以看到此信息.
我的问题是,为什么我的脚本在30秒后不超时? max_execution_time实际测量的是什么?
编辑以包含代码;
public function getSlotsByUser (Request $request) {
$event_id = $request->event_id;
$user_id = substr($request->user, 4);
$event = Event::find($event_id);
$user = User::find($user_id);
$slots = TimeSlot::where('event_id',$event_id)->get();
$userSlots = $user->slots;
foreach($userSlots as $userSlot) {
$guest = Guest::where('slot_id',$userSlot->id)->where('user_id',$user->id)->first();
if($guest) {
$userSlot->guest_id = $guest->id;
$userSlot->guest_name = $guest->name . ' ' . $guest->surname;
}
else {
$userSlot->guest_id = NULL;
$userSlot->guest_name = NULL;
}
$userSlotIds[] = $userSlot->id;
}
$days = new DatePeriod(
new DateTime($event->start_time),
new DateInterval('P1D'),
(new DateTime($event->end_time))->modify('+1 day')
);
return view('admin.calendar',compact('event','slots','user','userSlots','userSlotIds','days'));
}
我了解哪些部分代表使用Eloquent的查询.我的代码也去了;
PHP执行
PHP执行
PHP执行…等?
有人可以向我解释“幕后”发生了什么吗?
解决方法:
max_execution_time only affect the execution time of the script itself. Any time spent on activity that happens outside the execution of the script such as system calls using system(), stream operations, database queries, etc. is not included when determining the maximum time that the script has been running. This is not true on Windouws where the measured time is real.
“网络”标签中的等待状态只是告诉您,到目前为止,您没有从网络服务器获得任何响应.