CodeIgniter Loading Database Unnecessarily?
Just started using CodeIgniter, loving it.
Having enabled the database to be one of the libr开发者_运维问答aries to be loaded. I noticed that on pages that I don't even use the database (static pages). CI complains:
A Database Error Occurred Unable to connect to your database server using the provided settings.
The error is not a problem as I haven't supplied the correct username/password. The problem is, would CI try to connect to the database on every page load even though my application doesn't require it on that page or am I missing something?
Or am I missing the point of AutoLoad?
Thanks all
Autoload in Code Igniter tells the system to load a particular library at each page load. If you have static pages that don't require the database (and you don't want a connection to be made when they are loaded), then you need to stop the database from being autoloaded. You'll also need to manually load the database library on non-static pages where a db connection is necessary.
精彩评论