Quick Start
Installation
This project does not rely on Composer. Simply clone the project to a PHP-FPM runtime environment.
Running
Configuration
The configuration file is located at .env. You can modify the database connection information in it or add other configuration parameters required by the project.
Please copy
test.envto.envand modify the configuration parameters.
Use the native PHP getenv function to retrieve configuration parameters in the program.
Running
The project entry file is located at public/index.php.
When debugging locally, you can use the PHP built-in server to run the project. The command is as follows:
cd public
php -S localhost:8080in vscode can create command, tasks.json as follows:
{
"version": "2.0.0",
"tasks": [
{
"label": "run dev",
"type": "shell",
"command": "php -S 127.0.0.1:8080",
"options": {
"cwd": "public"
},
"problemMatcher": []
}
]
}in baota, website directory set to project directory, running directory set to /public
access
in browser, visit you set ip:port can, in example http://127.0.0.1:8080。
demo
project include a simple activation code management business application, need database support, database table structure as follows:
CREATE TABLE `code` (
`code` VARCHAR(32) NOT NULL COLLATE 'utf8mb4_general_ci',
`expire_time` DATETIME NULL DEFAULT NULL,
`used_time` DATETIME NULL DEFAULT NULL,
`create_time` DATETIME NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`code`) USING BTREE,
INDEX `used_time` (`used_time`) USING BTREE
)
COMMENT='激活码'
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
;