Yohanne Posted February 24, 2014 Share Posted February 24, 2014 Hi coders, any body explain y class not found and i use extends function: home.php <?php class home extends facility { public function s() { $this->x(); } } facility.php <?php class facility { public static function x() { echo "hello"; } } Thanks Quote Link to comment Share on other sites More sharing options...
trq Posted February 24, 2014 Share Posted February 24, 2014 Have you included facility.php ? Quote Link to comment Share on other sites More sharing options...
mogosselin Posted February 25, 2014 Share Posted February 25, 2014 Like trq said, you need to include the class "facility" so that the class "home" knows it exists. Try to add this at the top of your "home.php" file: <?php require('facility.php'); ?> Otherwise, you're telling PHP : Hey, make the class "home" by extending the class "facility". Then PHP tells you: What the hell is the class facility? (it doesn't scan all the files alone, you need to tell PHP what are the file needed to execute your code). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.