是否多次打开和关闭php标签会增加页面加载量? [英] Does opening and closing php tags multiple times increases page load?

查看:147
本文介绍了是否多次打开和关闭php标签会增加页面加载量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
打开/关闭标签&性能?

Possible Duplicate:
Opening/closing tags & performance?

这是一个新手问题,但是我在网上找不到明确的答案,所以请不要笑:)

This is a newbie question, but I could not find a clear answer on the net, so please don't laugh :)

  1. 打开和关闭php标签(<? php code ?>)多次是否会增加页面加载时间?

  1. Does opening and closing php tags ( <? php code ?>) multiple times increases page load time?

如何多次使用include templatepath?

How about using include templatepath multiple times?

谢谢

推荐答案

  1. 从理论上讲是的,但是差别很小,几乎在所有情况下都没有关系.

  1. Theoretically yes, but the difference is so miniscule that in almost all cases it wouldn't matter.

不确定您的意思.如果可能多次包含文件,请使用include_oncerequire_once.这样可以避免多次加载,并防止出现诸如无法重新声明类" 之类的错误.同样,它比includerequire昂贵,但更稳定.

Not sure about what you mean. If there is a possibility of a file being included multiple times, use include_once or require_once. This will prevent multiple loads and prevents errors like 'Cannot redeclare class'. Again this is more expensive than include and require, but more stable.

请注意,您的问题与代码无关,并且我确信这些问题已在SO中被多次询问和回答,因此,下次请尝试更好地搜索/询问:)

祝一切顺利!

这篇关于是否多次打开和关闭php标签会增加页面加载量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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