Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.0k views
in Technique[技术] by (71.8m points)

询问关于yii2命名空间及config配置引入问题

yii2自建目录命名空间不生效,我知道需要在这文件引用前使用Yii::setAlias命令设置别名或者在config/main.php的aliases里设置,目前我尝试过在aliases或者项目index.php使用Yii::setAlias,但是似乎均不生效。

判断缘由:在config/main.php的response->on beforeSend使用自建目录的配置
image
(箭头标注的行不生效)

image
(此文件为response->on beforeSend引入文件内容)

使用这种方式配置完毕后请求API报错
image

同时想询问一下yii2 config目录下没有bootstrap.php文件,我看别人的项目都有这个文件,里面配置的全是Yii::setAlias相关函数,如果我想使用bootstrap.php配置是否需要在index.php进行配置或者引入就可?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...