简体   繁体   English

如何在浏览器中将结构化的 HTML 代码显示为代码?

[英]How to display structured HTML code in the browser as code?

I want to create a simple HTML table generator.我想创建一个简单的 HTML 表格生成器。 I wrote a code that generates a table, but I would like to display the HTML code itself in a simple form (as here - https://scriptgenerator.net/html-table-simple-code-generator/ . And it is displayed in only one line. My example is here - https://webinsert.ru/1/我写了一个生成表格的代码,但我想以简单的形式显示 HTML 代码本身(如这里 - https://scriptgenerator.net/html-table-simple-code-generator/ 。它被显示只有一行。我的例子在这里 - https://webinsert.ru/1/

 <xmp> <?php if (isset($_POST["submit"])){ $width = $_POST["width"]; $bwidth = $_POST["bwidth"]; $cellpadding = $_POST["padding"]; $cellspacing = $_POST["spacing"]; $bordercolor=$_POST["borcolor"]; $bgc=$_POST["bgcolor"]; $rows = $_POST["rows"]; $cols = $_POST["columns"]; $tekst = 'Текст'; echo '<table width='.$width.'%'.' border='.$bwidth.' cellpadding='.$cellpadding.' cellspacing='.$cellspacing.' bordercolor='.$bordercolor.' style="background-color:'.$bgc.'">'; for ($tr=1; $tr<=$rows; $tr++){ echo '<tr>'; for ($td=1; $td<=$cols; $td++){ echo '<td>'. $tekst .'</td>'; } echo '</tr>'; } echo '</table></xmp>'; } ?>

Я использую но он не дает нужного эффекта. Я использую но он не дает нужного эффекта。

使用<pre>标签或<code>标签来显示结构。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM