发布于 2024-01-03 23:33:15 浏览 246 次
max_execution_time = 300
memory_limit = 256M
$context = stream_context_create(array(
'http' => array(
'timeout' => 300,
'header' => 'Content-Type: application/x-www-form-urlencoded\r\n'
)
));
$url = 'http://example.com/long/url';
$content = file_get_contents($url, false, $context);
如果你要读取非常长的 URL 内容,可能会导致 PHP 脚本的执行时间过长或者占用过多的内存资源。因此,在增加限制之前,请确保你的服务器环境具备足够的资源来处理这种情况。