I\'m trying to create a s shortcut to get user IP address, I created this function below in protected/helpers/shortcut.php
echo getIP(); fun
In Yii2, use Yii::$app->getRequest()->getUserIP()
Yii::$app->getRequest()->getUserIP()
try this:
Yii::app()->request->getUserHostAddress()
instead
Yii::app()->request->getUserHostAddress
with "()" it should work