Is there any good way to "determine whether a database exists, create it if it does not exist, then determine whether the table exists, and create it if it does not exist"?
If you want to use native syntax, don't you have to connect to the specified database in config.php? How to do it?
Thank you very much for having such a good platform to learn, thank you teacher
There are two ways to achieve the function you mentioned:
1. Create a SQL file and directly use native SQL statements to complete it;
2. Create a PHP script file;
ThinkPHP5 as a development framework is for the already created operate on the database. Usually it is necessary to cooperate with other database management tools.
There are two main categories of commonly used database management tools, one is the application program and the other is the web version.
Application: You can use navicat on Windows, and Squerl Pro is recommended on Mac;
The most common web version is phpMyAdmin, but it is too bloated. Now there is a good single-file version, called: Adminer.php, which has only one file, and there is also a MySQL-specific version, which is only more than 300k. I am using it, and I recommend you to try it too.