|
|
@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
#### 本地数据库部署
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
需要建立两个数据库:`computer_accessories`存放电脑配件信息,`webData`存放反馈和tips记录。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
先使用`mysql -u root -p`进入sql命令行界面,在该界面下进行数据库部署:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```sql
|
|
|
|
|
|
|
|
create database computer_accessories;
|
|
|
|
|
|
|
|
use computer_accessories;
|
|
|
|
|
|
|
|
source ~/dbData/computer_accessories.sql;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
create database webData;
|
|
|
|
|
|
|
|
use webData;
|
|
|
|
|
|
|
|
source ~/dbData/computer_accessories.sql;
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### 设置数据库连接
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
在项目`src`文件夹下的`dbConfig.json`文件是数据库连接配置文件,修改其中的主机名、用户名和密码来正常连接数据库。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"hostname": "192.168.136.129",
|
|
|
|
|
|
|
|
"username" : "root",
|
|
|
|
|
|
|
|
"password" : "1213800"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### 运行项目
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
首先下载好`php`,本项目使用的是`php 7.4.9`,建议下载软件`phpStorm`,进入软件后设置好`CLI Interpreter`路径(以下仅供参考):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
![image](https://tva3.sinaimg.cn/mw690/007EYOWmgy1gsf5i1ahuoj312c0a3jry.jpg)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
配置好了就可以从`phpStorm`中的`home.html`进入网站主页,网站就运行起来了。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
![image](https://tva2.sinaimg.cn/mw690/007EYOWmgy1gsf5ky5ut8j30wi07o761.jpg)
|