Cphalcon: Phalcon\Di\Exception: Service 'view' wasn't found in the dependency injection container File

Created on 8 Jan 2019  ·  2Comments  ·  Source: phalcon/cphalcon

Expected and Actual Behavior

i am goes wrong.

Phalcon\Di\Exception: Service 'view' wasn't found in the dependency injection container File=/Users/yyl/www/youerpai/core/bootstrap_web.php Line=68
#0 [internal function]: Phalcon\Di->get('view', NULL)
#1 [internal function]: Phalcon\Di->getShared('view')
#2 /Users/yyl/www/youerpai/core/bootstrap_web.php(68): Phalcon\Mvc\Application->handle(NULL)
#3 /Users/yyl/www/youerpai/public/index.php(26): require('/Users/yyl/www/...')
#4 {main}

This error occurs without any route matches.

https://www.google.com/search?q=Phalcon%5CDi%5CException%3A+Service+%27view%27+wasn%27t+found+in+the+dependency+injection+container+File&oq=Phalcon%5CDi%5CException%3A+Service+%27view%27+wasn%27t+found+in+the+dependency+injection+container+File&aqs=chrome..69i57j69i58.291j0j7&sourceid=chrome&ie=UTF-8 the error too many in google result!

Details

  • Phalcon version: (php --ri phalcon) 3.4.0
  • PHP Version: (php -v) PHP 7.2.8
  • Operating System: macOS, centeOS
not a bug

Most helpful comment

you must register view services manually, like below

$di->set('view',function () {
    $view = new View();
    $view->setViewsDir(APP_PATH . '/views/');
    return $view;
});

please refer the tutorial on the official website. tutorial-base

All 2 comments

you must register view services manually, like below

$di->set('view',function () {
    $view = new View();
    $view->setViewsDir(APP_PATH . '/views/');
    return $view;
});

please refer the tutorial on the official website. tutorial-base

i have register service view, and matched router has not zhe problem. no matched router has throw zhe error.杨玉龙-------- 原始邮件 --------主题:Re: [phalcon/cphalcon] Phalcon\Di\Exception: Service 'view' wasn't found in the dependency injection container File (#13744)发件人:Jayson Wang 收件人:phalcon/cphalcon 抄送:杨玉龙 ,Author you must register view services manually, like below
$di->set('view',function () {
$view = new View();
$view->setViewsDir(APP_PATH . '/views/');
return $view;
});
please refer the tutorial on the official website. tutorial-base

—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or mute the thread.

Was this page helpful?
0 / 5 - 0 ratings