Tp5 creates a datasheet

using the tp5 framework, how to execute create balte in php code to create a data table. The document provides query () and execute () methods, but these two methods return false, regardless of whether they are created successfully or not, so it is difficult to judge. I don"t know if there"s any other way. Wait online.

Php
Mar.07,2021

thinkphp5 now has a database migration tool similar to laravel

specific reference document: https://www.kancloud.cn/manua.

Warehouse address: https://github.com/top-think/.


I'll give you another way of thinking. You can use a tool like Navicat Premium to do everything about designing database tables, just connect to the database and use it. If you write the code to create the table in the php code, the first execution efficiency is low, the operation is more tedious, and there is more redundant cumbersome code. Tools can be used to quickly create, but also easy to modify the design. It is totally unnecessary to design a database in your code.
take a look at the development documentation.
https://www.kancloud.cn/manua.


use

try {
} catch(\Exception $e) {
}

the table can be created successfully as long as no exception is thrown.

Menu