Closed huacaizhi closed 3 years ago
生成测试数据报错提示: *** applying m190908_055507_init_data 是否生成测试问题数据? (yes|no) [yes]: [> ] 0% (0/100) ETA: n/a > execute SQL: INSERT INTO {{%merit_template}} (id, type, title, unique_id, method, event, action_type, rule_key, rule_value, increment, status, created_at, updated_at) VALUES (1, 1, '登录', 'site/login', 2, 0, 2, 1, 1, 2, 1, 1458657160, 1458823425), (2, 1, '发帖', 'topic/default/create', 2, 0, 2, 0, NULL, 6, 1, 1458657218, 1458657218), (3, 1, '回复', 'topic/comment/create', 2, 0, 2, 0, NULL, 4, 1, 1458657251, 1458657251), (4, 1, '发动弹', 'tweet/default/create', 2, 0, 2, 0, NULL, 4, 1, 1458657296, 1468647701); ... done (time: 0.001s) Exception 'yii\base\InvalidConfigException' with message 'Please configure UrlManager::hostInfo correctly as you are running a console application.'
id
type
title
unique_id
method
event
action_type
rule_key
rule_value
increment
status
created_at
updated_at
试试 https://forum.yiiframework.com/t/create-url-in-console-applications/71792
https://github.com/yiisoft/yii2/issues/2944#issuecomment-39192548
@forecho 谢谢,解决了。 console/config/main.php 的 components 数组下增加
urlManager' => [ 'class' => \yii\web\UrlManager::class, 'hostInfo' => 'http://www.example.com', ]
生成测试数据报错提示: *** applying m190908_055507_init_data 是否生成测试问题数据? (yes|no) [yes]: [> ] 0% (0/100) ETA: n/a > execute SQL: INSERT INTO {{%merit_template}} (
id
,type
,title
,unique_id
,method
,event
,action_type
,rule_key
,rule_value
,increment
,status
,created_at
,updated_at
) VALUES (1, 1, '登录', 'site/login', 2, 0, 2, 1, 1, 2, 1, 1458657160, 1458823425), (2, 1, '发帖', 'topic/default/create', 2, 0, 2, 0, NULL, 6, 1, 1458657218, 1458657218), (3, 1, '回复', 'topic/comment/create', 2, 0, 2, 0, NULL, 4, 1, 1458657251, 1458657251), (4, 1, '发动弹', 'tweet/default/create', 2, 0, 2, 0, NULL, 4, 1, 1458657296, 1468647701); ... done (time: 0.001s) Exception 'yii\base\InvalidConfigException' with message 'Please configure UrlManager::hostInfo correctly as you are running a console application.'