超链接php返回db值

时间:2018-05-21 07:43:53

标签: php mysql

您好我正在尝试添加超链接到我的PHP代码我尝试了很多组合,但无法弄清楚我在哪里出错。

我的查询

echo "https://www.mywebsite.com" . $row["Page"] ."<br>";

我试过

echo '<a href=""https://www.mywebsite.com" . $row["Page"] ." </a>' <br>";

它不起作用。链接来自db没有超链接

3 个答案:

答案 0 :(得分:1)

两者都错了,正确的是:

$row["Page"] = "/pages/women's-health.html";
$output = str_replace('\'', '', $row["Page"]);
echo "<a href='https://www.mywebsite.com".$output."'>".$row["Page"]."</a>";

<强> Online Demo

答案 1 :(得分:0)

试试这个:

echo "<a href='https://www.mywebsite.com/'".$row['Page']."'>click</a>";

答案 2 :(得分:0)

你可以试试这个

echo "<a href='https://www.mywebsite.com/".$row["Page"]."'>Link Name</a>";

如果/$row["Page"],则可以删除 public static T? GetGreatestOrDefault<T>(IEnumerable<T?> values) where T : struct { var any = values.Any(a => a.HasValue); if (!any) return null; var firstOrDefault = values.Where(v => v.HasValue) .Select(v => v.Value) .OrderByDescending(o => o) .FirstOrDefault(); return firstOrDefault; } 。{/ p>

相关问题