使用simplexml_load_file()加载gzip压缩的XML文件 [英] Load gzipped XML file with simplexml_load_file()

查看:102
本文介绍了使用simplexml_load_file()加载gzip压缩的XML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用simplexml_load_file()PHP函数加载gzip压缩的XML文件,但是我不知道如何解码它,因此我可以使用其中的数据.

I'm trying to load a gzipped XML file using simplexml_load_file() PHP function, but I don't know how to decode it so I can use the data in it.

推荐答案

使用将其读取为字符串file_get_contents() 使用 gzuncompress() 对其进行解压缩 并使用 simplexml_load_string() 将字符串加载为XML.

Read it to a string using file_get_contents() decompress it using gzuncompress() and load string as XML using simplexml_load_string().

这篇关于使用simplexml_load_file()加载gzip压缩的XML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆