Hello,
I have created a very simple php page (index.php) to test why I am getting no output after I “call” a php class. I am using an autoloader with the following code, and doing an echo just so I know I get something back. I am loading the autoloader with a bootstrap file which is loaded via php.ini.
spl_autoload_register(‘autoloader’);
function autoloader($class)
{
$path = DIRECTORY_SEPARATOR . ‘class’ . DIRECTORY_SEPARATOR . $class . DIRECTORY_SEPARATOR . $class . ‘.php’;
if(!empty($class)){
echo DIR . $path;
echo $path ;
include $path;
}
I get output from the echos so this is working. In my class file, test.php, I have this code…
Class test
{
public function test(){
echo ‘this is working’;
}
}
In my page index.php I see all echo’d output up to here, but after ‘this is working’ I cannot get anything else. Here is my index.php page I am using for this test.
<!DOCTYPE html>
<?php
$class = new test();
echo 'This is a test, but I cannot see it when I browse the page.';
?>
<html>
<body>
<a href="../../../">To Home!</a> <br /> <!-- Cannot see this either -->
</body>
</html>
Here is a screen shot of the page…
I am sure I am missing something, but I cannot find out what. Any help is much appreciated!!!
Thank you,
Leavii