yii2 - How can I tell if I am in 'console' mode -


i writing app runs browser. however, model functions called yii2 console. therefore, getting errors when trying access variables set in gui.

is possible tell mode in? there environment variable automatically set, or should set session variable in console app indicate state?

thanks in advance,

martin

you can use

if(is_a(yii::$app,'yii\console\application')) 

for console, and

if(is_a(yii::$app,'yii\web\application')) 

for web.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

spring cloud - How to configure SpringCloud Eureka instance to point to https on non standard port -

javascript - Bootstrap Popover: iOS Safari strange behaviour -