我有一张不同列的表格。他们是网站,点击时应该将我重定向到一个网站。但它正在我的本地主机上查看网站。
应该是
这是表格的代码:
nub(L) -> sets:to_list(sets:from_list(L)).
我该怎么做才能进入网站? 提前谢谢。
答案 0 :(得分:2)
更改此项,使用href的单引号,并使用协议
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
答案 1 :(得分:1)
您需要在http://
或https://
echo "<td><a href='http://" . $row['website'] . "'>" . $row['website'] . "</a></td>";
答案 2 :(得分:0)
如果变量$row['website']
在开始时有http://
,它会重定向到http://www.amity.edu/mauritius/
,否则会在开始时附加本地主机网址。
试试这个:
<?php
include ('db_connect.php');
$sql="select * from institution";
$result= mysqli_query($conn, $sql);
while ($row = mysqli_fetch_array($result)){
echo "<tr>";
echo "<td>" . $row['ins_id'] . "</td>";
echo "<td>" . $row['ins_name'] . "</td>";
echo "<td>" . $row['address'] . "</td>";
echo "<td>" . $row['contact'] . "</td>";
echo "<td><a href=" . addhttp($row['website']) . ">" . $row['website'] . "</a></td>";
echo "<td>" . $row['email'] . "</td>";
echo "</tr>";
}
echo "</table>";
function addhttp($url) {
if (!preg_match("~^(?:f|ht)tps?://~i", $url)) {
$url = "http://" . $url;
}
return $url;
}