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);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?