Thursday, 5 September 2013

PHP Include class to my mini framework - error

PHP Include class to my mini framework - error

Quick question. I have mvc (my mini framework ;) ) for eduction.
https://github.com/aras123/MiniFramework
If I create file test.php in root base (for example). Code test.php:
<?php
class Example {
public function __construct() {
echo 'This is example!';
}
}
And in my framework create action for IndexController and want include and
run class Example: Application/Controller/IndexController.php:
<?php
namespace Application\Controller;
use Framework\Controller;
class IndexController extends Controller {
public function _init() {
}
public function IndexAction() {
require 'test.php'; //path is ok
$aaa = new Example(); //is error
}
error message:
Fatal error: Class 'Application\Controller\Example' not found in
/Application/Controller/IndexController.php on line ...
Help me, thx

No comments:

Post a Comment