CodeIgniter: Redirect if database login info has not been entered?
I’m making a self-hosted downloadable web app using CodeIgniter and I’m looking for a way to automatically redirect to the installer if t开发者_开发技巧he database config file has not been filled out.
The problem is that CI errors out when it tries to connect to the DB (which it obviously can’t because it’s trying to load the database config file before it’s been filled out) before I can ever redirect. Is there a way that I can catch the Database Error and do some custom code (like a redirect) before it’s displayed?
i guess u can create a pre-controller hook to check if the db config file has some values or better yet test the connection , if not then redirect to the installer page.
精彩评论