DB connection via cakephp localhost

Asked 2 months ago, Updated 2 months ago, 5 views

Now, I would like to read the data I put in mysql with cakephp in localhost.
If the controller is not found for some reason, an error will appear and we cannot proceed.

File Name: UsersController

By the way, the path is localhost/Users/list (server name/controller/method name)
No matter how many times I try, it becomes Not found, so I think the path is wrong.

I'm sorry, but could you give me some advice?

mysql cakephp

2022-09-30 13:50

1 Answers

Have you created a controller method name in list?
The list is a reserved word for php and cannot be used as a method name.

PHP:list of keywords - Manual http://php.net/manual/ja/reserved.keywords.php

Change the controller method name.

If url must be /users/list, use routing to link the URL to the controller method.

Routing http://book.cakephp.org/2.0/ja/development/routing.html

Also, try to use IDE such as NetBeans and PHPSstorm to prevent easy mistakes such as using these reserved words incorrectly.


2022-09-30 13:50

If you have any answers or tips


© 2022 OneMinuteCode. All rights reserved.