tags:

views:

40

answers:

2

I have a class file: class_xx.php. And then a function file: function_xxx.php

In my function_xxx.php:

require_once('class_xx.php')

... // after few next lines

$object = new class_xx1($arg1, $arg2);

But it gives me:

Fatal error: Class 'class_xx1' not found in "some_path" on line "1XX3"

[sorry i cant exposed the codes yet], any idea why I included the file > require_once with no error, but it gives me "Class not found error"??

A: 

Chances are you misspelled the class declaration or something to that avail. You will what to double-check that your spell it the exact same way, with the same casing.

If you are developing on a secondary sever, you might have not transferred the completed class_xxx.php file over and just a blank file, in which case PHP would be including a blank file.

By the way, you forgot a semi-colon after the require_once

Chacha102
Ops, I forgot the semi-colon in this question. I try to re-transfer that file. But I could open the file in my server and its not blank.
mysqllearner
Arggg... stupid server. After I re-transfer the file, it works now. Thanks. Please close this thread as I think is useless now. No programming related. But if u wish to keep it, I respect your decision. Anyway, thanks a lot
mysqllearner
+1  A: 

Seemingly, the class_xx.php does not correctly declare the class_xx1 class. Review your code and watch for typos. Put some sort of debug line like echo "hello; in the required file if you want to be sure that it is being included correctly.

Matchu
Double check the typos, class name, everything is fine. Irritating
mysqllearner