file_get_contents出现错误的解决办法

 时间:2026-04-25 21:19:37

1、打开php.ini文件,extension=php_openssl.dll去掉前面的分号,allow_url_include = off改为allow_url_include = On,然后重启服务就可以了。如图

file_get_contents出现错误的解决办法

file_get_contents出现错误的解决办法

2、或者也可以通过使用curl函数来替代file_get_contents函数,当然php.ini打开了curl,extension=php_curl.dll,如图

file_get_contents出现错误的解决办法

3、最后分享个curl的函数

<?php

function getSslPage($url) {$ch = curl_init();curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);curl_setopt($ch, CURLOPT_HEADER, false);curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_REFERER, $url);curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);$result = curl_exec($ch);curl_close($ch);return $result;}echo getSslPage($_GET['url']);?>

  • ubuntu实战001:将ISO文件挂载配置成apt本地源
  • linux上使用java打war包
  • 怎样区分java中的基本数据类型和引用类型?
  • 邮箱设置DNS下A记录、mx记录、spf记录方法
  • 全民奇迹2怎么强化装备
  • 热门搜索
    标书怎么写 雷凌怎么样 三角形符号怎么打 手机怎么上推特 怎么去痘坑 igxe怎么卖东西 文玩核桃怎么玩 wis怎么样 怎么开车起步 漂流日记怎么写