Login   Register  
PHP Classes
elePHPant
Icontem

Including file once

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      Top level forums  >  PHP Specialists  >  General  >  Including file once  
Subject:Including file once
Summary:how to prevent fatal error without using require or include once
Messages:2
Author:Moazam
Date:2009-01-01 16:25:46
Update:2009-01-02 03:17:35
 

  1. Including file once   Reply   Report abuse  
Picture of Moazam
Moazam
2009-01-02 00:33:10
Hello,
I have been facing a fatal error in my web application. I am wondering if anyone can here give me the solution without using require_once or include_once.

here is the code
/*class: myapp.php*/
if(!defined('ACONST')) {
require("loader.php");
exit;
}
class myapp {
}

/*file: loader.php*/
require("myapp.php");

If you call myapp.php, web server will restart and in apache log you will see this error can't redeclare class myapp.php

is there any way to stop preventing php execution at end of the file?

There is 1 reply in this thread, which is not being displayed.
Browsing this forum thread replies is available only to premium subscribers.


Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.