繁体   English   中英

如何在浏览器中将HTML代码转换为模板输出

[英]How to convert Html code to template output in browser

我需要在模板中转换HTML 如图所示, 内容应显示为模板。 我正在用table展示。 但是现在我需要在模板输出中显示它

这是我的代码:

<table id="datatable" class="tablesorter"> 
    <span id='errfrmMsg'></span>
    <thead>
        <tr>        
            <th scope="col" id="">Name</th>
            <th scope="col" id="">Content</th>
        </tr>
    </thead>

    <tbody>
        <?php
            $templ_id = $_REQUEST['templ_id'];
            $getTemplateQuery = mysql_query("select * from templates where id = $templ_id");
            $getTemplateRow = mysql_fetch_array($getTemplateQuery);
        ?>
        <tr>
            <td valign="top" width="125"><?php echo $getTemplateRow['templ_name'];?></td>
            <td valign="top" width="319">
            <?php
                echo $templContent = $getTemplateRow['templ_content'];
?>
        </tr>
    </tbody>
</table>

这是输出:

在此处输入图片说明

从您的问题中可以得出的结论中,尝试输出:

$html = htmlspecialchars_decode($content)

编辑:

echo $templContent = htmlspecialchars_decode($getTemplateRow['templ_content']);

试试这个,这对您有帮助

<?php

echo $htmlContent = htmlspecialchars_decode($getTemplateRow['templ_content']) 

?>

暂无
暂无

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

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