php 链接地址中是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.页面显示如下:

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM