问题描述
这是一个新手问题,但是我在网上找不到明确的答案,所以请不要笑:)
This is a newbie question, but I could not find a clear answer on the net, so please don't laugh :)
-
打开和关闭php标签(
<? php code ?>
)多次是否会增加页面加载时间?
Does opening and closing php tags (
<? php code ?>
) multiple times increases page load time?
如何多次使用include templatepath?
How about using include templatepath multiple times?
谢谢
推荐答案
-
从理论上讲是的,但是差别很小,几乎在所有情况下都没有关系.
Theoretically yes, but the difference is so miniscule that in almost all cases it wouldn't matter.
不确定您的意思.如果可能多次包含文件,请使用include_once
或require_once
.这样可以避免多次加载,并防止出现诸如无法重新声明类" 之类的错误.同样,它比include
和require
昂贵,但更稳定.
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标签会增加页面加载量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!