[英]Include HTML file with a table into PHP
I have a table stored in an HTML file and I want to insert that into a WordPress page.我有一个存储在 HTML 文件中的表格,我想将其插入到 WordPress 页面中。 I used
echo file_get_contents('table.html')
but it didn't display anything.我使用
echo file_get_contents('table.html')
但它没有显示任何内容。 Then I tried echo htmlentities (file_get_contents('table.html'))
.然后我尝试
echo htmlentities (file_get_contents('table.html'))
。 This just outputs the HTML code into the page but does not render it.这只是将 HTML 代码输出到页面中,但不会呈现它。 How do I make the table display correctly?
如何使表格正确显示?
HTML table is something like: HTML 表格类似于:
<table class="fao-pricing-table-additional">
<tr>
<th class="fao-table-plan-details-header" rowspan="2">Plan Details</th>
<th class="fao-table-plan-starter-header">STARTER</th>
<th class="fao-table-plan-business-header">BUSINESS</th>
<th class="fao-table-plan-enterprise-header">ENTERPRISE</th>
<th class="fao-table-plan-corporate-header">CORPORATE</th>
</tr>
<tr>.......
You can just use an include()
statement to render HTML/PHP on a webpage您可以只使用
include()
语句在网页上呈现 HTML/PHP
Example例子
<div>
<p>The table will be between this paragraph</p>
<?php
include("table.html");
?>
<p>And this paragraph</p>
</div>
Use ' ./ ' to indicate the relative path to the file.使用“ ./ ”来指示文件的相对路径。
Example : echo file_get_contents("./table.html");示例:echo file_get_contents("./table.html");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.