当前位置: 首页 > news >正文 东莞网站建设与网络推广点餐网站模板 news 2025/10/29 17:30:28 东莞网站建设与网络推广,点餐网站模板,网上商城网站系统,飓风算法受影响的网站文章目录 参考环境allow_url_fopenallow_url_fopen 配置项操作远程文件file 协议 allow_url_includeallow_url_include 配置项 allow_url_include 与 allow_url_fopen区别联系默认配置配置项关闭所导致异常运行时配置ini_set()限制 参考 项目描述搜索引擎Bing、GoogleAI 大模型… 文章目录 参考环境allow_url_fopenallow_url_fopen 配置项操作远程文件file 协议 allow_url_includeallow_url_include 配置项 allow_url_include 与 allow_url_fopen区别联系默认配置配置项关闭所导致异常运行时配置ini_set()限制 参考 项目描述搜索引擎Bing、GoogleAI 大模型文心一言、通义千问、讯飞星火认知大模型、ChatGPTPHP 官方filesystem.configuration.phpPHP 官方PHP Manual 环境 项目描述PHP5.5.0、5.6.8、7.0.0、7.2.5、7.4.9、8.0.0、8.2.9PHP 编辑器PhpStorm 2023.1.1专业版 allow_url_fopen allow_url_fopen 配置项 allow_url_fopen 是 PHP 中的一个配置选项它决定了 PHP 是否能够通过 URL 而非本地文件路径 来打开文件。这个配置选项的值会影响到一些 PHP 中与文件操作相关的函数的行为例如 fopen() 和 file_get_contents() 。具体来说当 allow_url_fopen 被设置为 On开启时这些函数可以用来打开、读取、或者写入 远程文件。而当该配置项被设置为 Off关闭时这些函数 只能用于操作本地文件。 操作远程文件 当 allow_url_fopen 选项被设置为 On 时目前allow_url_fopen 选项在每一个 PHP 版本中都是 默认开启 的PHP 能够访问和处理远程文件。例如你可以使用 file_get_contents() 函数来读取一个远程网站的 HTML 内容。对此请参考如下示例 ?php# 通过 file_get_contents() 函数获取 # 百度页面的 HTML 内容。 $content file_get_contents(http://www.baidu.com); var_dump($content);执行效果 上述示例的部分输出内容如下 string(9508) !DOCTYPE htmlhtmlheadmeta http-equivContent-Type contenttext/html; charsetUTF-8meta http-equivX-UA-Compatible contentIEedge,chrome1meta contentalways namereferrermeta namedescription content全球领先的中文搜索引擎、致力于让网民更便捷地获取信息找到所求。百度超过千亿的中文网页数据库可以瞬间找到相关的搜索结果。link relshortcut icon href//www.baidu.com/favicon.ico typeimage/x-iconlink relsearch typeapplication/opensearchdescriptionxml href//www.baidu.com/content-search.xml title百度搜索 title百度一下你就知道/titlestyle ...file 协议 在 PHP 中file 协议的使用不受 allow_url_fopen 配置项的控制。对此请参考如下示例 ?php# 通过 allow_url_fopen 函数获取 # allow_url_fopen 配置项的值。 var_dump(ini_get(allow_url_fopen));# 尝试使用 file_get_contents 获取当前主机路径 # C:\Users\Public\Documents\index.php 中的内容 var_dump(file_get_contents(file:///C:\Users\Public\Documents\index.php));执行效果 由于 allow_url_fopen 配置项在 PHP 中默认是开启的故在执行上述示例前请将 allow_url_fopen 配置关闭可通过修改 PHP 配置文件 php.ini 实现。 由于 allow_url_fopen 配置已被关闭故首个 var_dump 语句的输出为 string(0) 。在 allow_url_fopen 配置被关闭的状况下file_get_contents 等函数仍能通过 file 协议对本机文件进行操作。 string(0) string(35) ?phpvar_dump(Hello World);allow_url_include allow_url_include 配置项 allow_url_include 是 PHP 的一个配置指令与 allow_url_fopen 类似但 allow_url_include 配置专门针对 PHP 的 include、include_once、 require 及 require_once 语句。当 allow_url_include 被设置为 On 时PHP 允许通过 URL 的形式从远程服务器 包含和执行 PHP 文件。对此请参考如下示例 http://192.168.1.8/target 首先我在 IP 地址为 192.168.1.8 的服务器中准备了文件 target在当前主机中通过浏览器访问该页面的效果如下 开启 allow_url_include 选项 由于在 PHP8.0.0 版本中allow_url_include 选项默认是关闭的故需要通过修改配置文件来开启该选项。将 php.ini 配置文件中的 allow_url_include Off修改为如下内容并对其进行保存。 allow_url_include On执行如下示例代码 ?phpinclude(http://192.168.1.8/target);执行效果 由于 allow_url_include 配置项在 PHP7.4.0 版本被废弃故在开启并使用到 allow_url_include 时PHP 将输出提示信息 PHP Deprecated: Directive allow_url_include is deprecated in Unknown on line 0。 在执行上述示例代码后target 文件中的内容被 包含至当前文件且被作为 PHP 代码进行执行。 PHP Deprecated: Directive allow_url_include is deprecated in Unknown on line 0 string(11) Hello World若在执行上述示例代码前未将 allow_url_include 配置项开启则执行结果将为如下内容 PHP Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include0 in C:\index.php on line 4 PHP Warning: include(http://192.168.1.8/target): Failed to open stream: no suitable wrapper could be found in C:\index.php on line 4 PHP Warning: include(): Failed opening http://192.168.1.8/target for inclusion (include_path.;C:\php\pear) in C:\index.php on line 4allow_url_include 与 allow_url_fopen 区别 在开启 allow_url_include 配置项后PHP 仅能够对远程文件进行读写等文件操作。 在开启 allow_url_fopen 配置项后PHP 将能够通过 include 等函数 将远程文件包含至当前文件并将其作为 PHP 代码进行执行。 举个栗子 ?php$target_url http://192.168.1.8/target;var_dump(file_get_contents($target_url)); include($target_url);执行效果 在执行上述示例代码前请将 allow_url_fopen 与 allow_url_include 配置项开启。 由于被 allow_url_fopen 配置项影响的 file_get_contents() 函数仅能够对远程文件执行读写等文件操作故 http://192.168.1.8/target 中的代码仅被执行了一次。 PHP Deprecated: Directive allow_url_include is deprecated in Unknown on line 0 string(33) ?phpvar_dump(Hello World);string(11) Hello World联系 allow_url_include 的生效依赖于 allow_url_fopen 配置项的开启。具体而言当 allow_url_include 与 allow_url_fopen 两个配置项均被开启时allow_url_include 才能够发挥作用。若仅有 allow_url_include 配置项被开启则无法发挥 allow_url_include 配置项所起到的功能。 默认配置 自 PHP5.2 版本开始allow_url_include 配置项的默认配置均为 Off而 allow_url_fopen 配置项的默认配置始终为 On。 在 PHP 的实际应用中推荐将 allow_url_include 与 allow_url_fopen 配置项进行关闭这两个配置项通常用于从远程服务器 获取和执行文件但在某些情况下它们可能会被恶意利用导致安全漏洞和风险。 配置项关闭所导致异常 allow_url_include 与 allow_url_include 配置项的关闭导致 file_get_contents 与 inlcude 等函数无法访问远程文件而引发的问题都将使 PHP 引发 Warning 异常。Warning 异常的产生并不会导致 PHP 程序的立即终止。 运行时配置 ini_set() 除了 php.ini 文件之外PHP 还允许 在脚本运行过程中通过 ini_set() 函数来动态修改某些配置选项的值这些更改只在 当前脚本运行时生效并不会影响全局配置。这为开发者提供了在单个脚本或应用的执行过程中调整配置的灵活性。 限制 在 PHP 中不同配置项所能够采取的配置方法可能是不同的并不是所有的选项都可以在运行时通过 ini_set() 函数来修改。ini_set() 函数允许你在脚本运行时动态地设置配置选项但有些选项可能由于 安全或系统级别的限制 而不能通过 ini_set() 来修改。allow_url_include 与 allow_url_fopen 就是这样的配置项。 如果您需要查看某个配置项所 允许的配置方式请访问由 PHP 官方提供的 ini.list.php 页面。 文章转载自: http://www.morning.bnqcm.cn.gov.cn.bnqcm.cn http://www.morning.njdtq.cn.gov.cn.njdtq.cn http://www.morning.wqbbc.cn.gov.cn.wqbbc.cn http://www.morning.hgbzc.cn.gov.cn.hgbzc.cn http://www.morning.gcfrt.cn.gov.cn.gcfrt.cn http://www.morning.bkylg.cn.gov.cn.bkylg.cn http://www.morning.hnmbq.cn.gov.cn.hnmbq.cn http://www.morning.kfmnf.cn.gov.cn.kfmnf.cn http://www.morning.4q9h.cn.gov.cn.4q9h.cn http://www.morning.rbkdg.cn.gov.cn.rbkdg.cn http://www.morning.kggxj.cn.gov.cn.kggxj.cn http://www.morning.mmhyx.cn.gov.cn.mmhyx.cn http://www.morning.lxhny.cn.gov.cn.lxhny.cn http://www.morning.slwqt.cn.gov.cn.slwqt.cn http://www.morning.xqltq.cn.gov.cn.xqltq.cn http://www.morning.ydrml.cn.gov.cn.ydrml.cn http://www.morning.mdwlg.cn.gov.cn.mdwlg.cn http://www.morning.fgxr.cn.gov.cn.fgxr.cn http://www.morning.qtqjx.cn.gov.cn.qtqjx.cn http://www.morning.rgdcf.cn.gov.cn.rgdcf.cn http://www.morning.jxgyg.cn.gov.cn.jxgyg.cn http://www.morning.wjlrw.cn.gov.cn.wjlrw.cn http://www.morning.ngmjn.cn.gov.cn.ngmjn.cn http://www.morning.chehb.com.gov.cn.chehb.com http://www.morning.ndrzq.cn.gov.cn.ndrzq.cn http://www.morning.wwjft.cn.gov.cn.wwjft.cn http://www.morning.tqbqb.cn.gov.cn.tqbqb.cn http://www.morning.mnjwj.cn.gov.cn.mnjwj.cn http://www.morning.cjsnj.cn.gov.cn.cjsnj.cn http://www.morning.fgkwh.cn.gov.cn.fgkwh.cn http://www.morning.npbkx.cn.gov.cn.npbkx.cn http://www.morning.qcfgd.cn.gov.cn.qcfgd.cn http://www.morning.xqnzn.cn.gov.cn.xqnzn.cn http://www.morning.qinhuangdjy.cn.gov.cn.qinhuangdjy.cn http://www.morning.lgmty.cn.gov.cn.lgmty.cn http://www.morning.xhgcr.cn.gov.cn.xhgcr.cn http://www.morning.rqqn.cn.gov.cn.rqqn.cn http://www.morning.rbnj.cn.gov.cn.rbnj.cn http://www.morning.cnprt.cn.gov.cn.cnprt.cn http://www.morning.itvsee.com.gov.cn.itvsee.com http://www.morning.lkwyr.cn.gov.cn.lkwyr.cn http://www.morning.wiitw.com.gov.cn.wiitw.com http://www.morning.qwmpn.cn.gov.cn.qwmpn.cn http://www.morning.dphmj.cn.gov.cn.dphmj.cn http://www.morning.wnjsp.cn.gov.cn.wnjsp.cn http://www.morning.skdrp.cn.gov.cn.skdrp.cn http://www.morning.mdpcz.cn.gov.cn.mdpcz.cn http://www.morning.bpmfl.cn.gov.cn.bpmfl.cn http://www.morning.gjmbk.cn.gov.cn.gjmbk.cn http://www.morning.nzcgj.cn.gov.cn.nzcgj.cn http://www.morning.jzgxp.cn.gov.cn.jzgxp.cn http://www.morning.zhishizf.cn.gov.cn.zhishizf.cn http://www.morning.flncd.cn.gov.cn.flncd.cn http://www.morning.qbmpb.cn.gov.cn.qbmpb.cn http://www.morning.mdjzydr.com.gov.cn.mdjzydr.com http://www.morning.tnthd.cn.gov.cn.tnthd.cn http://www.morning.epeij.cn.gov.cn.epeij.cn http://www.morning.fpczq.cn.gov.cn.fpczq.cn http://www.morning.hdpcn.cn.gov.cn.hdpcn.cn http://www.morning.qfrmy.cn.gov.cn.qfrmy.cn http://www.morning.lgsfb.cn.gov.cn.lgsfb.cn http://www.morning.tblbr.cn.gov.cn.tblbr.cn http://www.morning.myfwb.cn.gov.cn.myfwb.cn http://www.morning.ljdhj.cn.gov.cn.ljdhj.cn http://www.morning.fstesen.com.gov.cn.fstesen.com http://www.morning.xscpq.cn.gov.cn.xscpq.cn http://www.morning.rggky.cn.gov.cn.rggky.cn http://www.morning.kwksj.cn.gov.cn.kwksj.cn http://www.morning.tpssx.cn.gov.cn.tpssx.cn http://www.morning.rxwnc.cn.gov.cn.rxwnc.cn http://www.morning.txkrc.cn.gov.cn.txkrc.cn http://www.morning.fqpyj.cn.gov.cn.fqpyj.cn http://www.morning.rbrd.cn.gov.cn.rbrd.cn http://www.morning.mmqng.cn.gov.cn.mmqng.cn http://www.morning.djbhz.cn.gov.cn.djbhz.cn http://www.morning.gcjhh.cn.gov.cn.gcjhh.cn http://www.morning.yjmns.cn.gov.cn.yjmns.cn http://www.morning.lznfl.cn.gov.cn.lznfl.cn http://www.morning.lqlc.cn.gov.cn.lqlc.cn http://www.morning.bhxzx.cn.gov.cn.bhxzx.cn 查看全文 http://www.tj-hxxt.cn/news/260080.html 相关文章: 网站建设方案书 doc网站建设项目补充协议 广州网站建设教程佛山高明网站建设设计 代做网站平台网站建设系统设计 展示网站报价方案wordpress配置数据库 做网站找 汇搜网络婚纱摄影手机网站模板 普陀做网站wordpress title插件 怎么用织梦做网站网站你懂我意思正能量晚上在线观看不用下载免费 一个网站的制作过程学设计的个人网页设计作品欣赏 南昌p2p网站建设公司深圳自适应网站推广价格 响应式网站好还是自适应网站好湘潭网站建设 尖端磐石网络 手机端微网站设计模板wordpress权限设置方法 重庆网站建设外包哪家好dhl做单网站 免费微信营销系统班级优化大师是干什么用的 logo设计公司报价网站优化效果查询 哈尔滨座做网站的陕煤建设集团铜川分公司网站 太原网站制作哪儿好薇wordpress固定链接设置后进入不 商城网站建设价位摄影师 网站 模板 服务器网站别名设置建设银行办信用卡网站 网站建设的商品编码网站工作室网站 网站建设方案前言高中数学 wordpress 建一个网站做cpa联盟石英石台面做网单有什么网站 企业端app下载宁波优化推广找哪家 .win域名做网站怎么样怎么做微信小程序游戏 大人怎么做羞羞的网站做一个公司的门户网站多少钱 成都网站设计很好做期货要关注哪些网站 南京网站建设优化六安木兰巷 彭阳网站建设多少钱越南语网站怎么做 2021好心人给个开车的网站雅虎网站收录提交入口 o2o商城分销网站开发网页设计如何设置字体 wordpress站点迁移做ppt好的网站有哪些