file_get_contents不能获取带端口的网址

先们来了解file_get_contents() 函数,官方介绍说它是把整个文件读入一个字符串中,例子:

  1. <?php 
  2. echo file_get_contents("test.txt"); 
  3. ?> 

输出:This is a test file with test text.同样此函数还可以用于获取远程服务器上的内容:file_get_contents('http://www.phpfensi.com');这样也是没有问题,但是如果我带了端口了就有问题了,例如:

file_get_contents('http://localhost:12345');

没有任何获取,解决方法是:关闭selinux

1,永久方法–需要重启服务器

修改/etc/selinux/config文件中设置SELINUX=disabled ,然后重启服务器。

2,临时方法–设置系统参数

使用命令setenforce 0,附:

setenforce 1 设置SELinux 成为enforcing模式

setenforce 0 设置SELinux 成为permissive模式

php的allow_url_fopen选项是关闭了

原因是我们php.ini中把php的allow_url_fopen选项是关闭了,我们只要把它打开即可。

如果你没有权限打开allow_url_fopen的话我们可使用curl函数的来替换,也是很方法的。
波比源码 – 精品源码模版分享 | www.bobi11.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 本站源码并不保证全部能正常使用,仅供有技术基础的人学习研究,请谨慎下载
8. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!

波比源码 » file_get_contents不能获取带端口的网址

104 评论

  1. purchase olmesartan without prescription olmesartan generic order diamox 250mg for sale

  2. salbutamol 100 mcg without prescription order protonix 20mg brand viagra 50mg

  3. cheap dapsone 100 mg aceon 8mg pill order aceon pills

  4. buy motilium without prescription buy sumycin sale flexeril 15mg cheap

  5. oral metronidazole 200mg brand flagyl order bactrim 960mg generic

  6. order lamisil pill suprax brand purchase trimox without prescription

  7. purchase actos without prescription viagra 50mg price purchase viagra pills

  8. ivermectin order online order dapsone dapsone 100mg sale

  9. online casino slots no download free casino games online casino real money

  10. metformin 1000mg ca order nolvadex buy nolvadex 20mg generic

  11. purchase clomid generic clomid pill buy prednisolone generic

  12. Thank you great post. Hello Administ .onwin

  13. levaquin over the counter order levaquin brand zyban 150 mg

  14. buy letrozole no prescription viagra overnight order viagra 100mg

  15. tadalafil 20mg over the counter us cialis sales buy ed pills generic

  16. Everything is very open and very clear explanation of issues. was truly information. Click on the Keyword to Enter the Website. Wonodd

  17. buy sumycin 250mg pill ozobax pills baclofen generic

  18. buy cheap generic ketorolac oral inderal buy inderal tablets

  19. prometrium 200mg brand tindamax 500mg us buy zyprexa 10mg without prescription

  20. buy nateglinide generic atacand pills buy atacand online

  21. tadalafil 20mg without prescription Order viagra usa sildenafil overnight shipping

  22. purchase avanafil generic cambia canada buy diclofenac 50mg generic

  23. buy generic carvedilol online buy coreg 6.25mg buy aralen 250mg online

发表评论

Hi, 如果你对这款模板有疑问,可以跟我联系哦!

联系站长
赞助VIP 享更多特权,建议使用 QQ 登录
喜欢我嘛?喜欢就按“ctrl+D”收藏我吧!♡