Use the Phalcon development tool to generate the program framework from the command line
Set up the config.php, when the database to read, save data when there is a problem "Table ' XXX ' doesn ' t exist in database time dumping meta-data for XXX"
Notice that there is also a statement "Array to string conversion" above, to find the code corresponding to services.php
1 $di function Use ($config) {2 return New Dbadapter ($config-ToArray ()); 3 });
View $config content again
$config include __dir__. "/.. /app/config/config.php ";
config.php Content
1<?PHP2 3 return New\phalcon\config (Array(4' Database ' =Array(5' Adapter ' = ' Mysql ',6' Host ' = ' localhost ',7' Username ' = ' root ',8' Password ' = ',9' dbname ' = ' eduhelper ',Ten' CharSet ' = ' utf8 ', One), A' Application ' =Array( -' Controllersdir ' = __dir__. ‘/.. /.. /app/controllers/', -' Modelsdir ' = __dir__. ‘/.. /.. /app/models/', the' Migrationsdir ' = __dir__. ‘/.. /.. /app/migrations/', -' Viewsdir ' = __dir__. ‘/.. /.. /app/views/', -' Pluginsdir ' = __dir__. ‘/.. /.. /app/plugins/', -' Librarydir ' = __dir__. ‘/.. /.. /app/library/', +' Cachedir ' = __dir__. ‘/.. /.. /app/cache/', -' BaseUri ' = '/eduhelper/', + ) A));
The analysis is the database connection that block out the problem, you can see there is a ' application ' in the $config, and we need obviously only ' database '
The code at services.php should be changed to
1 $di function Use ($config) {2 return New Dbadapter ($config->database->ToArray ()); 3 });
Or
$di function Use ($config) { returnnew dbadapter ($config[' Database ']-> ToArray ());});
Database problems encountered using Phalcon development tools "Table ' XXX ' doesn ' t exist in database when dumping meta-data for XXX"