-5

我有一个脚本,其中 URL 将由管理面板更新并将其存储到 MySql 数据库中,如何将下面的代码转换为 php 并在 href 位置进行数据库调用,或者
我必须使用任何 javascript 来解决这个问题

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>H2</title>
</head>

<body>
<!--Link Of Product-->  
<a href="DYNAMIC LINK URL" target="_self">
<!--Image link-->   
<img src="images/h2.jpg" width="190" height="220" style="padding:0px 0px 0px 0px;">
</body>
</html>
4

1 回答 1

1

如果您从数据库中读取链接,您可以按照以下步骤进行。这个例子是考虑到你没有使用 MVC 风格的框架。

<?php 
    $link = mysql_fetch_assoc(mysql_query("SELECT url FROM admin"));
    ?>
    <a href="<?php echo $link['url']; ?>" target="_self">
于 2013-06-30T13:59:20.583 回答