采用以下配置
代码结构:
配置1:
advanced/api/modules/v1/controllers/GoodsController.php:
<?php
namespace api\modules\v1\controllers;
use yii\rest\ActiveController;
class GoodsController extends ActiveController
{
public $modelClass = 'api\models\Goods';
}
gii操作:
gii操作:
gii操作:
配置:url
配置:nginx
server {
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
}
参考的白狼栈的文章 http://www.manks.top/yii2-res...
用的MAMP PRO搭建环境,Nginx端口7888,Apache端口8888
走nginx服务器访问:http://localhost:7888/v1/goods
但访问 报404 Not Found: