想知道哪个更适合性能。该网站将被登录的用户和没有登录的用户查看。除了拥有更多权限之外,登录用户的网站几乎相同。所以我想知道什么会更有效率。PHP性能问题
// OPTION ONE
if(isLoggedIn()){
Write the whole web site plus the content the logged in user can access
}
else {
Write the whole website again, minus the content the logged in users can access.
}
//OPTION TWO
Write the website content and inset the login function wherever i need to restrict the access, so the function would be called a few different times.
我想知道它是否将是一个使用选项之一,因为该功能将首先检查一次更好的性能,并且不会需要重新检查,如果用户如果用户没有登录,它会忽略第一个块并加载第二个块。
总之,什么更容易维护?开发人员比服务器更昂贵(无论如何都是在低流量级别),所以请使用易于维护的版本(这恰好是#2)... – ircmaxell 2010-12-20 19:33:24
另一个蹩脚的问题。事实上,这个问题与性能调整无关,你无法调整任何这种蹩脚的方式。学习分析 – 2010-12-20 20:01:05