# eflow-backend **Repository Path**: oreomaker/eflow-backend ## Basic Information - **Project Name**: eflow-backend - **Description**: 智能污水处理设备后端 - **Primary Language**: Unknown - **License**: BSD-3-Clause - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2022-03-23 - **Last Updated**: 2022-12-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # eflow-backend 本项目为项目后端接口 目录结构 ------------------- assets/ contains assets definition commands/ contains console commands (controllers) config/ 项目配置 controllers/ 控制器 mail/ contains view files for e-mails models/ 停用 modules/ 具体的业务实现,通过callModuleService调用 helpers/ 自定义助手类 runtime/ contains files generated during runtime tests/ contains various tests for the basic application vendor/ contains dependent 3rd-party packages views/ contains view files for the Web application web/ 入口文件和资源文件 项目依赖 ------------ PHP最低可用版本为5.6.0(推荐7.4) 数据库使用mysql 安装 ------------ ### 通过Composer安装依赖 在项目根目录下,命令行输入: ```php composer install ``` composer将根据composer.json文件自动下载依赖。如果遇到网络问题,考虑更改composer源或科_上网 配置 ------------- ### 数据库 修改`config/db.php`,for example: ```php return [ 'class' => 'yii\db\Connection', 'dsn' => 'mysql:host=localhost;dbname=yii2basic', 'username' => 'root', 'password' => '1234', 'charset' => 'utf8', ]; ``` ### nginx服务器 nginx.conf文件示例: ``` http { server { listen 80; server_name 127.0.0.1; index index.php index.html index.htm; root index文件位置; #charset koi8-r; #access_log logs/host.access.log main; location / { try_files $uri $uri/ /index.php$is_args$args; if (!-e $request_filename){ rewrite ^/(.*) /index.php last; } } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; try_files $uri = 404; } } } ``` ### php配置 配置php.ini文件中的doc_root为项目目录下的web目录 (可能还需要开启对应的mysql extension) 运行 ------------ ### 通过框架提供的服务器 在命令行中,切换到项目根目录,运行 ``` php yii serve --port=9000 ``` 即以yii框架提供的服务器在9000端口运行 ### 通过php目录下的fast-cgi可执行文件(推荐) 在php安装目录下,命令行运行 ``` .\php-cgi.exe -b 127.0.0.1:9000 -c php.ini ``` 即以对应的php.ini配置文件运行php-cgi(处理nginx服务器请求,解析php文件) 项目中的cgi-starter.ps1为我电脑环境下的powershell脚本,可更改脚本后直接运行脚本启动php-cgi