我有一个存储 URL 的数据库表。我需要的是从表中获取这些 URL,并以 URL 的标题作为 anchor 使其可点击。
这是我试过的:
while($row4 = mysql_fetch_assoc($result4))
{
echo "<a href =\"$row4[Url1]\">".$row4['Title1']. "</a>";
}
它显示例如我的 tilte1
即 youtube
和 Url1
是 www.youtube.com
。
但是当我点击它时,它会转到 localhost/mysite/www.youtube.com
我该如何解决这个问题?
最佳答案
尝试:
echo "<a href =\"http://$row4[Url1]\">".$row4['Title1']. "</a>";
关于php - 从 mysql 中提取链接并使其可点击?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18506813/