首页 > 解决方案 > href 中包含 php 变量,没有打开正确的位置

问题描述

我有以下<td>带有<a>标签的标签,其中包含 href 中的 php 变量。我只能浏览到上传文件夹。有谁知道为什么?它应该浏览到uploads\$_POST['searchInput'] . 但它没有这样做。

<td class="viewEditTd"><button class = "btn btn-info viewEditButton"><a href="file://///172.xx.xx.xxx\TEMP\xxx\uploads\"<?php echo $_POST['searchInput']; ?>"\" target="_blank"><span class="
        glyphicon glyphicon-folder-open" aria-hidden="true"></span> View File</a></button></td>

标签: phphtml

解决方案


我能够在 Stack Overflow 论坛成员的帮助下解决这个问题。就这样解决了。我的问题如下

<td class="viewEditTd"><button class = "btn btn-info viewEditButton"><a href="file://///172.xx.xx.xxx\TEMP\xxx\uploads\"<?php echo $_POST['searchInput']; ?>"\" target="_blank"><span class="
        glyphicon glyphicon-folder-open" aria-hidden="true"></span> View File</a></button></td>

它是通过删除php标签周围的两个双引号来解决的。工作答案是

<td class="viewEditTd"><button class = "btn btn-info viewEditButton"><a href="file://///172.xx.xx.xxx\TEMP\xxx\uploads\<?php echo $_POST['searchInput']; ?>" target="_blank"><span class="
        glyphicon glyphicon-folder-open" aria-hidden="true"></span> View File</a></button></td>


推荐阅读