yii2 rest api 请求报错

Fatal error: Uncaught exception 'yii\base\InvalidArgumentException' with message 'Response content must not be an array.' in /Applications/MAMP/htdocs/yii2/wugongzu/vendor/yiisoft/yii2/web/Response.php:1057 Stack trace: #0 /Applications/MAMP/htdocs/yii2/wugongzu/vendor/yiisoft/yii2/web/Response.php(337): yii\web\Response->prepare() #1 /Applications/MAMP/htdocs/yii2/wugongzu/vendor/yiisoft/yii2/web/ErrorHandler.php(135): yii\web\Response->send() #2 /Applications/MAMP/htdocs/yii2/wugongzu/vendor/yiisoft/yii2/base/ErrorHandler.php(262): yii\web\ErrorHandler->renderException(Object(yii\base\ErrorException)) #3 [internal function]: yii\base\ErrorHandler->handleFatalError() #4 {main} thrown in /Applications/MAMP/htdocs/yii2/wugongzu/vendor/yiisoft/yii2/web/Response.php on line 1057

PHP7.0以上版本没有问题 $this->modelClass

PHP5.6版本报错 $this->modelClass,php5.6不支持$this->modelClass,改成和后台一样的用法就行

你可能感兴趣的:(YII2)