普通网友 2017-02-22 13:30
浏览 13
已采纳

超时无法在PHP Httpful请求中工作

I am having an http request and I am using "Httpful Request" to send it in PHP. I am setting a timeout of 20 seconds also in the request as follows:

$req = Request::get($Url);
$response = $req->timeoutIn(20)->expectsHtml()->send();

I was expecting to get an exception after timeout happens and I can handle the exception. But I am getting the following php Fatal error. Why is it so?

PHP Fatal error: Maximum execution time of 30 seconds exceeded in phar://C:/CapPortal/cpPortal/source/wordpress/httpful.phar/Httpful/Request.php on line 202

  • 写回答

2条回答 默认 最新

  • dongtanhe4607 2017-02-22 13:34
    关注

    You can use set_time_limit($seconds) to set that limit higher, if you need more execution time. You can also set it to 0, which means infinite. Warning: Apache (if you're using php with it) may also limit php's execution time.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?