I am try开发者_JS百科ing to auto load the facebook.php but it requires the app id and secret. Is it possible to pass parameters when auto loading a library in CodeIgniter ?
I recently did a blog post about this very topic.
The official facebook SDK plays very nice with Codeigniter and just requires you use a external config file to accomplish your goals of autoloading...
so you would just place a file facebook.php
in your config
directory with these contents
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$config['appId'] = 'YOUR_APP_ID_HERE';
$config['secret'] = 'YOUR_APP_SECRET_HERE';
At this point loading the library should pick up this config while autoloading or otherwise.
You can write a wrapper which will pre-initialize lib using config settings and expose it on one of its public members.
http://codeigniter.com/user_guide/libraries/config.html
精彩评论