初学Yii问个小疑点

WBOY
Release: 2016-06-13 13:42:28
Original
749 people have browsed it

初学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 示范代码里有具体应用。

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!