如何使用变量回显超链接 [英] How to echo a hyperlink with a variable

查看:63
本文介绍了如何使用变量回显超链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何用php中的变量回显多个超链接如...

在这里我必须动态这个超链接并从他们的数据库中获取他们的数据..

How to echo multiple hyperlink with a variable in php like..
In this i have to dynamic this hyperlink and fetching their data with their id from database..

<ul>
 <li><a href="bca.html">BCA</a></li>
             <li><a href="bca.html">BBA</a></li>
             <li><a href="bca.html">BSC</a></li>
             <li><a href="bca.html">B.Tech</a></li>
</ul>

推荐答案

使用关联数组 [ ^ ],例如:



use associate array[^], e.g.:


links = array( BCA => bca.html BSC => bsc.html);

echo ' < UL>';
foreach(
links = array("BCA"=>"bca.html", "BSC"=>"bsc.html"); echo '<ul>'; foreach(


links as
links as

这篇关于如何使用变量回显超链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆