PHP/HTML在“源代码”视图中显示并运行,但不在浏览器中


PHP/HTML appears and functions in Source view but not in browser?

我的一些代码似乎可以在源代码视图中工作,但不会出现在我的浏览器中?

它是由PHP echo生成的表中的一个链接。来源:

<td><a href=http://www.webaddresshere.com></a></td>

生成它的代码是:

<td><a href=<?php echo htmlentities($row['website'], ENT_QUOTES, 'UTF-8'); ?></a></td>

下面是完整的表格:

    <h3>Listings</h3>
<table cellpadding="10%" cellspacing="10%" width="100%">
<tbody align="left">
    <tr>
        <th></th>
        <th>Supplier</th>
        <th>Service</th>
        <th>Price</th>
        <th>Website</th>
        <th>Telephone</th>
    </tr>
    <?php foreach($rows as $row): ?>
        <tr>
            <td></td>
            <td><?php echo htmlentities($row['supplier'], ENT_QUOTES, 'UTF-8'); ?></td>
            <td><?php echo htmlentities($row['service'], ENT_QUOTES, 'UTF-8'); ?></td>
            <td><?php echo htmlentities($row['price'], ENT_QUOTES, 'UTF-8'); ?></td>
            <td><a href=http://<?php echo htmlentities($row['website'], ENT_QUOTES, 'UTF-8'); ?>></a></td>
            <td><?php echo htmlentities($row['telephone'], ENT_QUOTES, 'UTF-8'); ?></td>
        </tr>
        <tr>
        <td><br></td>
        </tr>
    <?php endforeach; ?>
</table>

关于它为什么这么做,有什么想法吗?

谢谢。

查看此处-

<td><a href=http://www.webaddresshere.com></a></td>
------------------------------------------^

链接中没有文本。

这是因为链接中没有文本,所以基本上没有链接任何内容。

<td><a href=<?php echo htmlentities($row['website'], ENT_QUOTES, 'UTF-8'); ?>Some Text Here For It To Be Clickable</a></td>
<h3>Listings</h3>
<table cellpadding="10%" cellspacing="10%" width="100%">
    <tbody align="left">
        <tr>
            <th></th>
            <th>Supplier</th>
            <th>Service</th>
            <th>Price</th>
            <th>Website</th>
            <th>Telephone</th>
        </tr>
        <?php foreach($rows as $row): ?>
        <tr>
            <td></td>
            <td><?php echo htmlentities($row['supplier'], ENT_QUOTES, 'UTF-8'); ?></td>
            <td><?php echo htmlentities($row['service'], ENT_QUOTES, 'UTF-8'); ?></td>
            <td><?php echo htmlentities($row['price'], ENT_QUOTES, 'UTF-8'); ?></td>
            <td><a href="http://<?php echo htmlentities($row['website'], ENT_QUOTES, 'UTF-8'); ?>">Link</a></td>
            <td><?php echo htmlentities($row['telephone'], ENT_QUOTES, 'UTF-8'); ?></td>
        </tr>
        <tr>
            <td><br></td>
        </tr>
    <?php endforeach; ?>
</table>

选中此处,我添加了一个文本"链接",点击时应该可见:)。