<legend id='ZcgIZ'><style id='ZcgIZ'><dir id='ZcgIZ'><q id='ZcgIZ'></q></dir></style></legend>

<small id='ZcgIZ'></small><noframes id='ZcgIZ'>

    • <bdo id='ZcgIZ'></bdo><ul id='ZcgIZ'></ul>
  1. <i id='ZcgIZ'><tr id='ZcgIZ'><dt id='ZcgIZ'><q id='ZcgIZ'><span id='ZcgIZ'><b id='ZcgIZ'><form id='ZcgIZ'><ins id='ZcgIZ'></ins><ul id='ZcgIZ'></ul><sub id='ZcgIZ'></sub></form><legend id='ZcgIZ'></legend><bdo id='ZcgIZ'><pre id='ZcgIZ'><center id='ZcgIZ'></center></pre></bdo></b><th id='ZcgIZ'></th></span></q></dt></tr></i><div id='ZcgIZ'><tfoot id='ZcgIZ'></tfoot><dl id='ZcgIZ'><fieldset id='ZcgIZ'></fieldset></dl></div>
    <tfoot id='ZcgIZ'></tfoot>

    1. 为什么 file_get_contents 可用于 google.com 而不能用于我的网站?

      Why does file_get_contents work with google.com but not with my site?(为什么 file_get_contents 可用于 google.com 而不能用于我的网站?)
      <i id='lflsJ'><tr id='lflsJ'><dt id='lflsJ'><q id='lflsJ'><span id='lflsJ'><b id='lflsJ'><form id='lflsJ'><ins id='lflsJ'></ins><ul id='lflsJ'></ul><sub id='lflsJ'></sub></form><legend id='lflsJ'></legend><bdo id='lflsJ'><pre id='lflsJ'><center id='lflsJ'></center></pre></bdo></b><th id='lflsJ'></th></span></q></dt></tr></i><div id='lflsJ'><tfoot id='lflsJ'></tfoot><dl id='lflsJ'><fieldset id='lflsJ'></fieldset></dl></div>

        <bdo id='lflsJ'></bdo><ul id='lflsJ'></ul>

        <small id='lflsJ'></small><noframes id='lflsJ'>

        <tfoot id='lflsJ'></tfoot><legend id='lflsJ'><style id='lflsJ'><dir id='lflsJ'><q id='lflsJ'></q></dir></style></legend>

              <tbody id='lflsJ'></tbody>

              1. 本文介绍了为什么 file_get_contents 可用于 google.com 而不能用于我的网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                $page1 = file_get_contents('http://www.google.com');
                
                $page2 = file_get_contents('http://localhost:8000/prueba');
                

                当我回显结果时,在 Google 上它可以工作,但在我的网站上却不起作用.当我把地址放在资源管理器上时.这发生在我在 django 中制作的所有网站上.:(

                When I echo the results, with Google it works but not with my site. And when I put the address on the explorer works. And this happen with all the site that i make in django. :(

                警告:file_get_contents(http://localhost:8000/prueba) [function.file-get-contents]:无法打开流:连接尝试失败,因为连接方没有正确一段时间后响应,或建立连接失败,因为连接的主机没有响应.在 C:xampphtdocssquirrelmailpluginscaptchaackends2evo2evo.php 第 138 行

                Warning: file_get_contents(http://localhost:8000/prueba) [function.file-get-contents]: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:xampphtdocssquirrelmailpluginscaptchaackends2evo2evo.php on line 138

                致命错误:第 138 行 C:xampphtdocssquirrelmailpluginscaptchaackends2evo2evo.php 中的最大执行时间超过 60 秒

                Fatal error: Maximum execution time of 60 seconds exceeded in C:xampphtdocssquirrelmailpluginscaptchaackends2evo2evo.php on line 138

                推荐答案

                对于使用 PHP 内置 Web 服务器(在我的情况下使用 Laravel)遇到此问题的任何人,这是由于您的请求被 file_get_contents()/卷曲函数.

                For anyone having this problem using PHP Built-in web server (with Laravel in my case), it is caused by your request being blocked by file_get_contents() / curl functions.

                文档 开发服务器说

                如果请求被阻止,PHP 应用程序将停止.

                PHP applications will stall if a request is blocked.

                由于PHP内置服务器是单线程的,在你的服务器上请求另一个url将停止第一个请求并超时.

                Since the PHP built-in server is single threaded, requesting another url on your server will halt first request and it gets timed out.

                作为解决方案,您可以使用适当的网络服务器(nginx、apache 等).

                As a solution, you can use proper web server (nginx, apache etc.).

                到目前为止,我真的建议您使用 Laravel Sail 作为 PHP 项目的开发环境.它为您设置和配置不同服务(网络服务器、数据库、队列等)节省了大量时间.

                As of now, I really suggest you to use Laravel Sail as a development environment for PHP projects. It saves you lots of time with setup and configuration of different services (webserver, databases, queues, etc.).

                这篇关于为什么 file_get_contents 可用于 google.com 而不能用于我的网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Appending GET parameters to URL from lt;formgt; action(将 GET 参数附加到来自 lt;formgt; 的 URL行动)
                Forcing quot;Save Asquot; dialog via jQuery GET(强制“另存为通过 jQuery GET 对话框)
                PHP - get certain word from string(PHP - 从字符串中获取某个单词)
                How to debug a get request in php using curl(如何使用 curl 在 php 中调试 get 请求)
                get a # from a url in php(从 php 中的 url 获取 #)
                PHP - include() file not working when variables are put in url?(PHP - 将变量放入 url 时,include() 文件不起作用?)
                    <tbody id='NB0Do'></tbody>
                  <i id='NB0Do'><tr id='NB0Do'><dt id='NB0Do'><q id='NB0Do'><span id='NB0Do'><b id='NB0Do'><form id='NB0Do'><ins id='NB0Do'></ins><ul id='NB0Do'></ul><sub id='NB0Do'></sub></form><legend id='NB0Do'></legend><bdo id='NB0Do'><pre id='NB0Do'><center id='NB0Do'></center></pre></bdo></b><th id='NB0Do'></th></span></q></dt></tr></i><div id='NB0Do'><tfoot id='NB0Do'></tfoot><dl id='NB0Do'><fieldset id='NB0Do'></fieldset></dl></div>
                  <legend id='NB0Do'><style id='NB0Do'><dir id='NB0Do'><q id='NB0Do'></q></dir></style></legend>

                      <small id='NB0Do'></small><noframes id='NB0Do'>

                        <bdo id='NB0Do'></bdo><ul id='NB0Do'></ul>
                      • <tfoot id='NB0Do'></tfoot>