1st here is my folder structure :-
CODE
demo
|
|-demo1.php
|
|-ok
|
|-MyClass1.php
|
|-MyClass2.php
demo1.php code:-
CODE
<?php
$url = "ok/";
function __autoload($class_name)
{
include_once("'"."ok/".$class_name.".php"."'");
}
$obj = new MyClass1();
$obj2 = new MyClass2();
$obj->show1();
echo "<br>";
$obj2->show2();
?>
MyClass1.php code:-
CODE
<?php
class MyClass1
{
function show1()
{
echo("yahoo it is demo1");
}
}
?>
MyClass2.php code:-
CODE
<?php
class MyClass2
{
function show2()
{
echo("love you pyar say");
}
}
?>
when i try to call that demo1.php i got error :-
CODE
Warning: include_once('ok/MyClass1.php') [function.include-once]: failed to open stream: No such file or directory in D:\xampp\htdocs\Web\demo\demo1.php on line 7
Warning: include_once() [function.include]: Failed opening ''ok/MyClass1.php'' for inclusion (include_path='.;D:\xampp\php\pear\') in D:\xampp\htdocs\Web\demo\demo1.php on line 7
Fatal error: Class 'MyClass1' not found in D:\xampp\htdocs\Web\demo\demo1.php on line 9
i dont know why ?