Jump to content

Class Not Found When Extending


Pain

Recommended Posts

Hello again. I am trying to extend a class, but it gives me an error:

Fatal error: Class 'Redirection' not found in /home/searchqu/public_html/game/class.session_destroy.php on line 3

 

 

Im trying to extend the logout class:

<?php
session_start();
class SessionDestroy extends Redirection{

public function destroy_session() {

session_destroy();

Redirection::redirect("login");

}


}

?>

 

this is my redirection class:


<?php


class Redirection {

function redirect($parameter) {

header("Location: $parameter");

}

}

?>

 

and this is my actual logout page:


<?php
ob_start();
require('class.session_destroy.php');
require('class.redirect.php');

$logout = new SessionDestroy;
$redirect = new Redirection;
$logout->destroy_session();
ob_end_flush();
?>

 

What could be the problem here? Thanks:]

Link to comment
https://forums.phpfreaks.com/topic/270945-class-not-found-when-extending/
Share on other sites

erm...I fail to see how either of those classes merit actualy being classes in this scenario.

 

You also have no scope on function redirect()

 

You do have the Redirect class declaired before the SessionDestroy one right? if it deffinately is then have you tried calling $this->redirect() or $parent->redirect() ?

The way you are calling the the classes through includes, and the fact that each class basicly performs a single line of code, yeah, procedural would make more sense to me. It's just my point of view, there are others about that would tell you to even allow the word procedural to enter your mind unbidden is punnishable by 3 lashes and 4 hail Marys.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.