简体   繁体   English

对于PHP的SimpleXML而言,什么大小的xml文件太大? 是否取决于字节的大小以及节点嵌套的深度?

[英]What size xml file is too big for PHP's SimpleXML? Does it depend on size in Bytes on how deeply nested the nodes are?

I think I pretty much asked it all in the headline. 我想我几乎在标题中都问过这一切。

The issue I'm having is that I'm trying to parse an XML file with SimpleXML that SOMETIMES fails to read the xml but sometimes is successful. 我遇到的问题是,我正在尝试使用SimpleXML解析XML文件,以至于SOMETIMES无法读取xml,但有时会成功。 I can only think it's down to the script running out of memory. 我只能认为这是脚本内存不足的原因。

I have 200mb XML product feed, but it's only nested to around 4 layers maximum. 我有200mb的XML产品Feed,但最多只能嵌套到4层左右。 Is it okay to use SimpleXML for this? 为此可以使用SimpleXML吗? Is it just a case of increasing my memory limit in php.ini (I can't do it to test it yet as my server imposes maximums)? 是否只是增加了我在php.ini中的内存限制的一种情况(因为我的服务器施加了最大值,所以我无法进行测试)?

Thanks! 谢谢!

The maximum file size that PHP can handle and the maximum file size that your system can handle is two different things. PHP可以处理的最大文件大小和系统可以处理的最大文件大小是两件事。 You have to adjust how much memory PHP can access and SimpleXML is fine to use. 您必须调整PHP可以访问多少内存,并且SimpleXML可以很好地使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM