M
M
Monitorkin2017-02-28 20:14:58
Yii
Monitorkin, 2017-02-28 20:14:58

Why is @web not converted to a path?

I write like this:

<img src="<?= '@web/users/avatars/'.Yii::$app->user->identity['img'];?>" class="user-image" alt="User Image">

output like this:
<img src="web/users/avatars/userimg.png" class="user-image" alt="User Image">

and it should be like this:
<img src="http://site.ru/web/users/avatars/userimg.png" class="user-image" alt="User Image">

What's wrong?!! :-)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Ne-Lexa, 2017-02-28
@Monitorkin

\Yii::getAlias('@web')

M
Monitorkin, 2017-02-28
@Monitorkin

and, that's it, I understood, I screwed up myself, put Url::to('@web/users/avatars/'.Yii::$app->user->identity['img'], true), it worked, thanks everyone)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question