Home >Backend Development >PHP Tutorial >初学Yii问个小疑点

初学Yii问个小疑点

WBOY
WBOYOriginal
2016-06-13 10:08:26843browse

初学Yii问个小问题
Yii::app()->params['name']

请问这一般是获取什么数据的?是获取组件上的数据么?一般什么时候用?

------解决方案--------------------
一般写在 protected/config/params.php 文件中。

1.在protected/config/main.php 配置:'params'=>require(dirname(__FILE__).'/params.php'),
2.把一些常用配置写在 params.php文件中,如:'title'=>'My Yii Blog',
全局调用 Yii::app()->params['title']

yii framework下载包/demos/blog 示范代码里有具体应用。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn