简体   繁体   English

如何在ckeditor中保存PHP表单和代码?

[英]How to save PHP form and codes in ckeditor?

I got a problem to save source code as form or PHP in ckeditor, I mean, when I save codes in "source" it's okay, but if I will edit it again, it will remove some part of codes automatically, like form id , form class, div class, even JavaScript, just it's fine with HTML code, but If I'll add PHP code, it can be saved but after edit the page, it will remove some classed in PHP, how to solve it ? 我在ckeditor中将源代码保存为表单或PHP时出现问题,我的意思是,当我在“源”中保存代码时没关系,但如果我再次编辑它,它会自动删除部分代码,如表单ID,表单类,div类,甚至JavaScript,只是它的HTML代码很好,但是如果我要添加PHP代码,它可以保存但是在编辑页面之后,它会删除PHP中的一些类,如何解决它?

why it will remove some classed and PHP code automatically after editing the page in ckeditor ? 为什么它会在ckeditor中编辑页面后自动删除一些分类和PHP代码?

This is an example for my problem I'm going to save this code in ckeditor 这是我的问题的一个例子我将在ckeditor中保存此代码

    <li>        
      <label for="senderName">Your Name</label>     
      <input type="text" name="senderName" id="senderName" placeholder="Please type your name" required="required" maxlength="40" />            <li>Your Name</li>
    </li>

But after save, it will remove some part of codes and it will save like this: 但保存后,它将删除部分代码,它将保存如下:

    <li>Your Name</li>

why automatically ckeditor will remove input, label, placeholder and etc? 为什么ckeditor会自动删除输入,标签,占位符等? How can I solve this issue? 我该如何解决这个问题?

Thank you 谢谢

Well this is not the best practice to save your PHP code withi ckeditor in DB because it will not work as expected by you. 这不是在数据库中使用ckeditor保存PHP代码的最佳实践,因为它不会按预期工作。

But this might help you to getting rid of restriction some tag in ckeditor 但这可能会帮助你摆脱ckeditor中的限制

CKEDITOR.config.allowedContent = true; 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM