简体   繁体   English

如何加快php simplexml

[英]How to speed up php simplexml

I have some code that utilizes simplexml to retrieve some data. 我有一些利用simplexml检索一些数据的代码。

I perform about 4 functions that each use simplexml, per entry in a database. 我对数据库中的每个条目执行大约4个函数,每个函数都使用simplexml。 So if i have 4 entries in the database, im running simplexml 16 times to load that content. 因此,如果我在数据库中有4个条目,则我将运行simplexml 16次以加载该内容。

Problem is that it takes about a quarter of a second or so to load each item, so as the page loads, it trickles in and takes a second or two to load the entire page. 问题在于,加载每个项目大约需要四分之一秒,因此,在页面加载时,它会滴入并加载一整秒的时间来加载整个页面。

Is there anyway to easily speed this up, or cash this, or some better way of watching my page expand with content each time it loads? 是否有任何方法可以轻松地加快速度,兑现现金,或者以更好的方式观看页面每次加载时都随着内容扩展?

好吧,您只需要解析一次XML,然后将解析的对象传递给每个函数。

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

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