N
N
nnkrasovok2019-05-29 01:47:58
Yii
nnkrasovok, 2019-05-29 01:47:58

How to correctly display links from a record in a database table field?

Made alerts that are entered into the database table. Now, if you write down the notification "Thank you, follow the link", so that the link is on the word "link"? And then when I display a notification from the database, then there are problems with the transition. I don't know how to write correctly.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ruslan Ruslanov, 2019-05-29
@nnkrasovok

using yii2-html-helper

<?php
use yii\helpers\Html;//это - в самый верх файла
//что-то
$id = 'ид для тега';
$url = 'ваша ссылка';
echo Html::a('Ссылка', $url, ['class' => 'class', 'id' => $id]);

just php html
//что-то
$id = 'ид для тега';
$url = 'ваша ссылка';
echo "<a href='" . $url . "' id='" . $id . "'>Ссылка</a>";

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question