Will including unnecessary php files slow down website?

前端 未结 9 1877
醉话见心
醉话见心 2020-12-20 15:23

The question might prompt some people to say a definitive YES or NO almost immediately, but please read on...

I have a simple website where there are 30 php pages (e

9条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-20 15:41

    If your site is object-oriented I'd recommend using auto-loading (http://php.net/manual/en/language.oop5.autoload.php).

    This uses a magic method (__autoload) to look for a class when needed (it's lazy, just like you!), so if a particular page doesn't need all the classes, it doesn't have to get them!

    Again, though, this depends on if it is object-oriented or not...

提交回复
热议问题