Hi guy,
yes the file name is User_log.php in Model directory ,and including below User_log class.
below code is my index.php with loader in root/public/
<?php
use Phalcon\Loader;
use Phalcon\Mvc\View;
use Phalcon\Mvc\Url as UrlProvider;
use Phalcon\Mvc\Application;
use Phalcon\DI\FactoryDefault;
use Phalcon\Db\Adapter\Pdo\Mysql as DbAdapter;
use Phalcon\Session\Adapter\Files as Session;
use Phalcon\Mvc\Router;
try {
$loader = new Loader();
$loader->registerDirs(array(
'../apps/controllers/',
'../apps/models/'
))->register();
// Create a DI
$di = new FactoryDefault();
$di->set('db',function(){
return new DbAdapter(array(
'host' =>'localhost',
'username' =>'root',
'password' =>'root',
'dbname' =>'forum'
));
});
// Setup the view component
$di->set('view', function () {
$view = new View();
$view->setViewsDir('../apps/views/');
return $view;
});
$di->set('url', function () {
$url = new UrlProvider();
$url->setBaseUri('/');
return $url;
});
$di->setShared("session", function(){
$session= new Session();
$session->start();
return $session;
});
$di->set("modelsCache", function (){
$frontCache = new Phalcon\Cache\Frontend\Data(
array(
"lifetime" => 86400
));
$cache = new Phalcon\Cache\Backend\Memcache($frontCache,array(
"host" => "localhost",
"port" => "11211"
));
return $cache;
});
$application = new Application($di);
echo $application->handle()->getContent();
} catch (\Exception $e) {
echo "PhalconException: ", $e->getMessage();
}
You mean User_log.php
? And how you are loading it with loader ? Remember that phalcon follows PSR-0:
https://www.php-fig.org/psr/psr-0/#underscores-in-namespaces-and-class-names
So if you have User_log
class it should be stored under root folder/User/log.php