ApiController.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace frontend\controllers;
  3. use Yii;
  4. use yii\base\InvalidParamException;
  5. use yii\web\BadRequestHttpException;
  6. use yii\web\Controller;
  7. use yii\filters\VerbFilter;
  8. use yii\filters\AccessControl;
  9. use common\models\LoginForm;
  10. use frontend\models\PasswordResetRequestForm;
  11. use frontend\models\ResetPasswordForm;
  12. use frontend\models\SignupForm;
  13. use frontend\models\ContactForm;
  14. /**
  15. * Site controller
  16. */
  17. class ApiController extends Controller
  18. {
  19. public function behaviors()
  20. {
  21. return [
  22. 'verbs' => [
  23. 'class' => VerbFilter::className(),
  24. 'actions' => [
  25. 'api' => ['get', 'post'],
  26. 'index' => ['get', 'post'],
  27. ],
  28. ],
  29. ];
  30. }
  31. public function actionApi()
  32. {
  33. return 'hello world';
  34. }
  35. /**
  36. * Displays contact json交互.
  37. *
  38. * @return mixed
  39. */
  40. public function actionJson()
  41. {
  42. $post=Yii::$app->request->get();
  43. var_dump($post);
  44. }
  45. }