PHP 打印出 HTML,而不是处理 HTML

问题描述 投票:0回答:3
php wordpress
3个回答
1
投票

您正在使用

text/plain
MIME 类型的变体进行输出。您需要使用默认标头 (
text/html
) 发送它,以便浏览器正确解析它。

例如:

<?php
    header('Content-Type: text/html', true);
    echo showtime_schedule_handler($atts, $content);
?>

0
投票

而不是

return $output;

尝试

return html_entity_decode($output);

0
投票

用途:

return htmlspecialchars($output, ENT_QUOTES);

此函数将特殊字符转换为 HTML 实体。使用 ENT_QUOTES 确保双引号和单引号都被编码。

© www.soinside.com 2019 - 2024. All rights reserved.