SiteController.php 436 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace api\modules\v1\controllers;
  3. use yii\rest\ActiveController;
  4. use yii\rest\Controller;
  5. /**
  6. * Site controller
  7. */
  8. class SiteController extends ActiveController
  9. {
  10. public $modelClass = 'api\models\user';
  11. public function actionIndex()
  12. {
  13. \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
  14. return [
  15. 'message' => 'API test Ok!',
  16. 'code' => 100,
  17. ];
  18. }
  19. }