PHP/HTML是否在源代码视图中显示并运行,而不是在浏览器中?
我的一些代码似乎在源代码视图中工作,但没有出现在浏览器中 它是由PHP echo生成的表中的链接。在源代码中看起来是这样的:PHP/HTML是否在源代码视图中显示并运行,而不是在浏览器中?,php,html,href,html-table,Php,Html,Href,Html Table,我的一些代码似乎在源代码视图中工作,但没有出现在浏览器中 它是由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><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>
选中此处,我添加了一个文本“链接”,点击时应该可以看到:。将一些文本添加到超链接中。锚是空的,您需要为浏览器添加一些内容以创建可见的链接。旁注:记住在HREF周围使用引号。这只是一个很好的HTML实践。我们应该很快就能听到脸掌的声音。嘿…现在还早,我们可能会听到足够多的声音,产生像掌声一样的声音…人群变得疯狂起来!谢谢,我认为出于某种原因,保留该空白会使实际地址显示为链接,这也会使htmlentities的事情!再次感谢!
<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>