开发者

CodeIgniter Loading Database Unnecessarily?

开发者 https://www.devze.com 2022-12-15 16:47 出处:网络
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 page

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消