Reputation: 532
I have a function on load that checks a users login status. Here is a small chunk of the code...
//
// user is logged in, get user info
$user = Model\User::getByKey($_COOKIE['ukey']);
if($user->field('id') >= 1 || !isset($status)) {
//
// establish google connection
Classes\Google\Google::construct($user->field('id'), $user->field('ga_account'));
...
I have an __autoload function which finds the path of the file perfectly fine. However, I get a fatal error because the "\Classes\Google\Google" class is not found.
new Google() ... is located at /classes/google/google.class.php. The file is there, the autload function has the correct file path but why isn't the class found?
I do not have any namespacing on this particular Google() class file. This is all custom built, not a third party framework.
Upvotes: 0
Views: 231
Reputation: 638
1- use class_exists to make sure class is loaded . 2- if class not loaded , in google.class.php make a die , so u'll know file loaded or not. 3- if class loaded , make a new object here . the test it , so u can find the class definition is true or not.
Upvotes: 1