What is a good way to create databases and data tables in thnkphp5?
正念的奇迹
正念的奇迹 2017-08-03 17:45:37
0
1
1698

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

正念的奇迹
正念的奇迹

继续学习奋勇向前

reply all (1)
Peter_Zhu

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.

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!