php - yii import extension not finding class -
i using facebook sdk php. added facebook php sdk in yii app protected/extension folder , imported in config/main.php follow.
'import' => array( 'application.extensions.facebook.*', ),
my problem app not finding classes in sdk when create object follows:
$session = new facebooksession($access_token);
it giving error follow:
fatal error: class 'facebooksession' not found ....
if try using include_once()
or require_once()
giving error below:
fatal error: cannot redeclare class facebook\facebooksession in d:\localhost\protected\extensions\facebook\facebooksession.php on line 36
what going wrong?
solved adding
set_include_path(yii::app()->baseurl . directory_separator . 'protected' . directory_separator . 'extensions' . directory_separator . 'facebook');
require_once (yii::app()->baseurl . directory_separator . 'protected' . directory_separator . 'extensions' . directory_separator . 'facebook' . directory_separator . 'autoload.php');
require_once (yii::app()->baseurl . directory_separator . 'protected' . directory_separator . 'extensions' . directory_separator . 'facebook' . directory_separator . 'src' . directory_separator . 'facebook' . directory_separator . 'facebooksession.php');
and creating object
$session = new facebook\facebooksession($access_token);
Comments
Post a Comment