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 -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -