【发布时间】:2017-03-07 10:39:30
【问题描述】:
我会尽量快速简单地理解它。我的 PHP 项目有问题,我无法修复它,我的网站中有一个 CKEditor 实例。
这是配置和实例:
<script src="assets/ckeditor/ckeditor.js" charset="UTF-8"></script>
<textarea class="ckeditor" name="editor1" id="editor" rows="10" cols="80" required value="<?php if($error) echo $profdesc; ?> ">
<?php echo $profdesc; ?>
</textarea>
<script>
CKEDITOR.replace('editor1', {
contentsCss: "assets/ckeditor/test.css",
uiColor: '#428bca',
extraPlugins: 'wordcount,lineheight,colorbutton,smiley',
wordcount: {
showWordCount: true,
showParagraphs: false,
showCharCount: true,
maxCharCount: 3000,
paragraphsCountGreaterThanMaxLengthEvent: function (currentLength, maxLength) {
$("#informationparagraphs").css("background-color", "crimson").css("color", "white").text(currentLength + "/" + maxLength + " - paragraphs").show();
},
wordCountGreaterThanMaxLengthEvent: function (currentLength, maxLength) {
$("#informationword").css("background-color", "crimson").css("color", "white").text(currentLength + "/" + maxLength + " - word").show();
},
charCountGreaterThanMaxLengthEvent: function (currentLength, maxLength) {
$("#informationchar").css("background-color", "crimson").css("color", "white").text(currentLength + "/" + maxLength + " - char").show();
},
charCountLessThanMaxLengthEvent: function (currentLength, maxLength) {
$("#informationchar").css("background-color", "white").css("color", "black").hide();
},
paragraphsCountLessThanMaxLengthEvent: function (currentLength, maxLength) {
$("#informationparagraphs").css("background-color", "white").css("color", "black").hide();
},
wordCountLessThanMaxLengthEvent: function (currentLength, maxLength) {
$("#informationword").css("background-color", "white").css("color", "black").hide();
}
}
});
</script>
一切正常.. 直到我用这个编辑器更新“描述”,我的所有表和 mysql 都为 UTF-8,或者至少我认为我有它。 这可能是 UPDATE SQL 的问题,这里是其余代码。 在这种情况下,我试图将“Olá”保存在数据库中。
if(mysqli_query($con, "UPDATE users SET username='" . $name1 .
"',description='" . $descr . "',gender='" . $gender .
"',location='" . $location . "',ocupation='" . $ocupation .
"' WHERE user_id = '" . $_SESSION['usr_id'] . "'"))
【问题讨论】:
-
确保列/表为
CHARACTER SET utf8(或utf8mb4)
标签: php html mysql utf-8 ckeditor