dongqiang8683 2016-08-02 20:09
浏览 66
已采纳

WYSIWYG文本编辑器显示查询不好

I have a problem i integreted the CKeditor to my CMS, and when i copy some text to the query show me a <\h2> <\p> after a

, then if a try to delete those statament , after i deleted it showed me on page more <\h2> <\p>

<\p>

 <\p>

 <\p>

 <\p>

page.php

// Query the body section for the proper page
    $stmt = $con->prepare('SELECT pagebody FROM travel WHERE link = ?');
    $stmt->bind_param('s', $pageid);
    $stmt->execute();
    $result = $stmt->get_result();
    while ($row = $result->fetch_array()) {
        // do something with $row
        $body = htmlspecialchars_decode(stripslashes($row['pagebody'])); //pentru caractere speciale

    } <?php echo $body; ?>

//edit_page

<?php
// You may want to obtain refering site name that this post came from for security purposes here
// exit the script if it is not from your site and script
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$pid = $_POST['pid'];
$titlu = $_POST['titlu'];
$link = $_POST['link'];
$keyword = $_POST['keyword'];
$poza = $_POST['poza'];
$descriere = $_POST['descriere'];
$data = $_POST['data'];
$pagebody = $_POST['pagebody'];
// Filter Function -------------------------------------------------------------------
function filterFunction ($var) { 
    $var = nl2br(htmlspecialchars($var));
    $var = str_replace("/", "\\\\", $var);
    $var = preg_replace("~/~", "\\\\", $var);

    return $var; 
} 
$titlu = filterFunction($titlu);
$link = filterFunction($link);
$keyword = filterFunction($keyword);
$poza = filterFunction($poza);
$descriere = filterFunction($descriere);
$data = filterFunction($data);
$pagebody = filterFunction($pagebody);
// End Filter Function --------------------------------------------------------------
include_once "../conx.php";
// Add the updated info into the database table
$stmt = $con->prepare("UPDATE travel SET titlu=?, link=?, keywords=?, poza=?, descriere=?, pagebody=?, data=? WHERE id = ?");
    // TODO check that $stmt creation succeeded
    // "s" means the database expects a string
    $stmt->bind_param("ssssssss", $titlu, $link, $keyword, $poza, $descriere, $pagebody, $data, $pid);
    $stmt->execute();
    $stmt->close();
  • 写回答

1条回答 默认 最新

  • duanleiliu7373 2016-08-02 20:43
    关注

    That's due to this line in your PHP code:

     $var = str_replace("/", "\\\\", $var);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度