I have been working with CakePHP for sometime and for some reason today i started getting the Missing Controller Exception - Error: BlogController could not be found. while trying to access a /blog route.
I have created the blog.ctp file inside of the Pages directory.
And this is my route code
$routes->connect('/blog', ['controller' => 'Pages', 'action' => 'blog'], ['routeClass' => 'DashedRoute']);
And inside my PagesController.php i have created the blog function as well.
public function blog()
{
$this->viewBuilder()->setlayout('frontend');
}
Am i doing something wrong here? Is it a bug in the version of CakePHP I'm using? Because i have never gotten this error earlier.
I'm using CakePHP - 3.7.4.
Ok, So if any of you face this issue just get a new composer composer create-project --prefer-dist cakephp/app
Either i had missing files or something got deleted. Everything works after a fresh install.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.