Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.