php <a href></a>链接地址中是php变量,链接文本也是php变量的代码处理方法

1.所用php变量名为$recent_tests,是一个二维数组,示例如下:

1 $recent_tests[0]["test_url"] = www.baidu.com
2 $recent_tests[0]["result_url"] = www.baidu12345678_result.com
3 $recent_tests[1]["test_url"] = www.https://cnpvgvb1od054.pvgl.sap.corp:8443/store/.com
4 $recent_tests[1]["result_url"] = www.https://cnpvgvb1od054.pvgl.sap.corp:8443/store/_result.com

2.其中"test_url"为页面显示内容,"result_url"为链接定向地址,即href值。

3.代码如下:

 1 <table class="table table-hover">
 2 <thead>
 3   <tr>
 4     <th>#</th>
 5     <th>URL</th>
 6   </tr>    
 7   </thead>
 8   <tbody>
 9       <tr>
10          <th scope="row">1</th>
11       <td><a href="<?php $recent_tests[0]["result_url"] ?>" target="_blank"><?php echo $recent_tests[0]['test_url']; ?></a></td>
12        </tr>
13     <tr>
14            <th scope="row">2</th>
15            <td><a href="<?php $recent_tests[1]["result_url"] ?>" target="_blank"><?php echo $recent_tests[1]['test_url']; ?></a></td>
16     </tr>
17   </tbody>
18 </table>

4.页面显示如下:

 

posted @ 2016-07-26 18:29  SHERO_Vae  阅读(5767)  评论(0编辑  收藏  举报