网站换行修复代码 技术交流

PHP
<?php
                    $content_parts = parseContentWithCodeBlocks($post['post_content']);
                    foreach ($content_parts as $part) {
                        if ($part['type'] == 'text') {
                            $text = trim($part['content']);
                            if ($text !== '') {
                                $processed_text = parseTextWithMarkersSafe($text);
// 关键:不要对 $processed_text 使用 htmlspecialchars,直接输出
                                echo '<div class="post-text-content" style="white-space: pre-wrap;">' . $processed_text . '</div>';
                            }
← 返回列表

评论 (0)

登录后可以发表评论

立即登录
💬

还没有评论,快来发表第一条评论吧!