2015-11-26 16:33:14 3017次浏览 1条回答 0 悬赏 20 金钱

请问使用postMan插件进行测试的时候使用api.test.com/users可以得到数据,但是使用api.test.com/users?username=test123&email=test123@qq.com&password=1234567以post方式发送时就发生错误

{"name":"Integrity constraint violation","message":"SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'username'\nThe SQL being executed was: INSERT INTO user (status, created_at, updated_at) VALUES (10, 1448523987, 1448523987)","code":23000,"type":"yii\db\IntegrityException","file":"/Applications/MAMP/htdocs/advanced/vendor/yiisoft/yii2/db/Schema.php","line":628,"stack-trace":["#0 /Applications/MAMP/htdocs/advanced/vendor/yiisoft/yii2/db/Command.php(791): yii\db\Schema->convertException(Object(PDOException), 'INSERT INTO `us...')","#1 /Applications/MAMP/htdocs/advanced/vendor/yiisoft/yii2/db/Schema.php(448): yii\db\Command->execute()","#2 /Applications/MAMP/htdocs/advanced/vendor/yiisoft/yii2/db/ActiveRecord.php(454): yii\db\Schema->insert('{{%user}}', Array)","#3 /Applications/MAMP/htdocs/advanced/vendor/yiisoft/yii2/db/ActiveRecord.php(424): yii\db\ActiveRecord->insertInternal(NULL)","#4 /Applications/MAMP/htdocs/advanced/vendor/yiisoft/yii2/db/BaseActiveRecord.php(593): yii\db\ActiveRecord->insert(true, NULL)","#5
您需要登录后才可以回答。登录 | 立即注册
cgp
助理

cgp

注册时间:2015-10-27
最后登录:2015-12-15
在线时长:5小时32分
  • 粉丝1
  • 金钱140
  • 威望0
  • 积分190

热门问题