Posted inProgramming / php / Yii

PHP Yii Framework Global Variables Tutorial with Examples

PHP Yii Framework Global Variables Tutorial with Examples

Today, We want to share with you PHP Yii Framework Global Variables Tutorial with Examples.
In this post we will show you Yii CApplication, hear for php – declaring global variables in yii and use them in controller we will give you demo and example for implement.
In this post, we will learn about CApplication global variables – Yii Framework with an example.

Yii CApplication ->Yii::app()

CApplication is the base class for all application classes. It contains global variables, functions etc. Below We put some IMP PHP based yii most reused methods or functions and some basic config properties of yii web application. Basically we will call simple this functions Like as “Yii::app()”

Properties/ Functions Output
echo Yii::app()->baseUrl /yiiapi
Yii::app()->timeZone UTC
Yii::app()->setLanguage()
Yii::app()->setId()
Yii::app()->setHomeUrl()
Yii::app()->setBasePath()
Yii::app()->name My Web Application
Yii::app()->localeDataPath D:\wamp\www\yiiapi\yiiframework\framework\i18n\data
Yii::app()->language en_us
Yii::app()->id 3fe52c6c
Yii::app()->homeUrl /yiiapi/index.php
Yii::app()->getTimeZone() UTC
Yii::app()->getLanguage() en_us
Yii::app()->getId() 3fe52c6c
Yii::app()->getHomeUrl() /yiiapi/index.php
Yii::app()->getBaseUrl() yiiapi
Yii::app()->getBasePath() D:\wamp\www\yiiapi\protected
Yii::app()->createUrl(“/”) /yiiapi/index.php
Yii::app()->createAbsoluteUrl(“/”) http://127.0.0.1/yiiapi/index.php
Yii::app()->basePath D:\wamp\www\yiiapi\protected
Yii::app()->SetTimeZone() Asia/Calcutta

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Yii CApplication.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype