How does yii customize a global configuration item?

Source: Internet
Author: User
How does yii customize a global configuration item? You guys, I just started using yii and want to customize a global configuration item, similar. net web. as configured in config, can access: Yii: app ()-& gt; myconfig be defined like this? What should I do? ------ Solution ---------------------- The main configuration file contains a params & nbsp; key. How can I customize a global configuration item for yii?
Ladies and gentlemen, I just started using yii.
I want to customize a global configuration item, similar to the configuration in web. config in. net.
Access: Yii: app ()-> myconfig like this
Can this be defined? What should I do?


------ Solution ----------------------
In the main configuration file
Which has a params key. Just write it in.
Then in the controller
$ This-> params ['Your key']
------ Solution ----------------------
Upstairs positive solution

The recommended practice is at the bottom of/config/main. php. the default value is

'Params' => array (
'Adminmail' => [email protected] ',
),

Change

'Params' => require ('params. php '),


Create a params. php file in/config.

Return array (
'Adminmail' => [email protected] ',
);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.