我正在使用 codeigniter 和 mysql 进行 Web 开发。我还使用了一个名为 tinymce 编辑器的富文本编辑器。我的问题是我在文本区域中应用了文本编辑器。当我应用标题和段落标签等时,一切都很好,但是当我用来“居中”文本时,它使用了 css 的“样式”标签,例如 style="text-align:center;" 但是当我将它插入数据库时,它不包括双引号 "" 它将插入的只是 style= 并且它不会包括 "" 和它里面。
The code below is used to insert data from the form including the textarea that was applied with the tinymce text-editor.
$("#send_email").click(function()
{
$("#myModal_loader").modal('show');
var email_add = $("#email").val();
var email_subject = $("#email_subject").val();
var email_message = tinymce.get('email_message').getContent();
var postData = {
'email_add':email_add,
'email_subject':email_subject,
'email_message':email_message
};
$.ajax({
type: "POST",
url: "<?php echo base_url();?>students/send_email",
dataType: 'json',
data: postData,
success: function(data)
{
$("#myModal_loader").modal('hide');
$("#myModal_confirm").modal('show');
$("#email_subject").val("");
$("#email_message").val("");
console.log();
}
});
$("html, body").animate({ scrollTop: 0 }, 600);
return false;
});
});
</script>
控制器
$this->course_booking_model->insert_email_data
($stored_email,$tennant_email,$email_subject,$email_message);
模型
function insert_email_data($email_add,$tennant_email,$email_subject,$email_message) {
for($i=0;$i<count($email_add);$i++){
$data = array(
'email_add' => $email_add[$i],
'tennant_email' => $tennant_email,
'email_subject' => $email_subject,
'email_message' => $email_message
);
$this->db->set('time_sent','NOW()',FALSE);
$this->db->insert('email', $data);
}
}