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