簡體   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