CI Determine If Library Is Loaded

CI Determine If Library Is Loaded

0 5360

I recently needed to determine if a library was loaded in CI form my Model. I have the CI Rest library using the same model for a query and wanted to change the query if the system had a user logged in. I simply wanted to check and see if the Tank Auth library was loaded and grab the user id from it if it was. I ended up using the PHP function class_exists.

    if(class_exists('Ion_auth')) {
        //Include user specific query stuff here
    }

SIMILAR ARTICLES

NO COMMENTS

Leave a Reply