Replies: 2 comments 4 replies
-
|
Beta Was this translation helpful? Give feedback.
3 replies
-
Use Phalcon loader: use Phalcon\Autoload\Loader;
$loader = new Loader();
$loader->setFiles([BASE_PATH.'/composer_vendor/autoload.php']);
/**
* We're a registering a set of directories taken from the configuration file
*/
$loader->setDirectories([
APP_PATH . '/controllers',
APP_PATH . '/models'
]);
$loader->setNamespaces([
'MyApp' => APP_PATH,
'MyApp\Controllers' => APP_PATH . '/controllers',
'MyApp\Models' => APP_PATH . '/models',
'MyApp\Utils' => APP_PATH . '/utils'
]);
$loader->register(); Then import using |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all, I'm new to Phalcon and I'm trying to do a simple thing, it run properly in windows, but when i move to server in centOS, it get error
Uncaught Error: Class 'test' not found in /var/www/html/qlhoso/app/controllers/TestController.php:10\nStack trace:\n#0 [internal function]: TestController->indexAction()\n#1 [internal function]: Phalcon\Dispatcher\AbstractDispatcher->callActionMethod(Object(TestController), 'indexAction', Array)\n#2 [internal function]: Phalcon\Dispatcher\AbstractDispatcher->dispatch()\n#3 /var/www/html/qlhoso/public/index.php(90): Phalcon\Mvc\Application->handle('/test')\n#4 {main}\n thrown in /var/www/html/qlhoso/app/controllers/TestController.php on line 10
//////////////////////////
// Register an autoloader
$loader = new Loader();
$loader->registerDirs(
[
APP_PATH . '/controllers/',
APP_PATH . '/models/',
]
);
$loader->register();
file structure:
php_info()
Phalcon
Author Phalcon Team and contributors
Version 4.1.0
Build Date Dec 31 2020 11:19:09
Powered by Zephir Version 0.12.19-4345593
psr
Version 1.0.1
Released 2020-11-12
Authors John Boehr [email protected] (lead)
PSR-3 Log Version 1.0.0
PSR-6 Cache Version 1.0.0
PSR-7 Http Message Version 1.0.0
PSR-11 Container Version 1.0.0
PSR-13 Link Version 1.0.0
PSR-14 Event Dispatcher 1.0.0
PSR-15 HTTP Handlers (Server Handler) 1.0.0
PSR-15 HTTP Handlers (Middleware) 1.0.0
PSR-16 Simple Cache Version 1.0.0
PSR-17 HTTP Factories 1.0.0
PSR-18 HTTP Client 1.0.0
Beta Was this translation helpful? Give feedback.
All reactions