系统有一个页面,需要用户自己填写文本信息, 我把百度编辑器嵌入进来了,但不知道怎么获取写好的内容,然后提交。生成php文件。
现在不知道这个编辑器怎么用form提交,本身这个不带form,查了一下资料也没弄出来。
谢谢
两个问题,
1、如何获取编辑器填写的内容。
2、编辑器所填内容将内容生成php文件
回复讨论(解决方案)
直接在编辑器的textarea或者script标签上添加name属性就可以,跟普通的textarea一样
<script type="text/javascript" src="<?=base_url()?>../bootstrap/js/ueditor/ueditor.config.js"></script><script type="text/javascript" src="<?=base_url()?>../bootstrap/js/ueditor/ueditor.all.js"></script><link rel="stylesheet" href="<?=base_url()?>../bootstrap/js/ueditor/themes/default/dialogbase.css"/><div id="myEditor"></div><script type="text/javascript"> //var URL= "<?=base_url().'application/views/default/'?>"; var editor = new baidu.editor.ui.Editor(); editor.render("myEditor"); //alert(editor.getContent()) ; </script><form action="<?=base_url()?>admin/content" method="post" id="myFormID" ><script type="text/plain" id="myEditor" name="myEditor"></script><input type="submit" name="submit" value="提交"></form>
这是我之前的,不太会加,请教,谢谢
id为myEditor为什么有2个,把div的那个去掉
你在提交后的脚本var_dump($_POST)就可以看到了
出来了,如果要得到编辑器中的 源码(html源码), 怎么处理啊? 谢谢
为了之后再把html源码生成php文件
$_POST['myEditor']就是编辑器里的html代码了吧
$_POST['myEditor']就是编辑器里的html代码了吧
不是,是写的纯文本. 类似表单提交后的text
百度编辑器本身有个
editor.getContent() 这个函数,可以获取,但不知道现在将它加在哪块
什么,你文本框的name="myEditor",后台就用这个获取啊
$this->input->post('myEditor'));
上边可以得到,但不是源码
我想得到
写的XX内容
带标签的源码
上边可以得到,但不是源码
我想得到
写的XX内容
带标签的源码
我翻了以前写的,的确是只要用这个就可以得到html源码。
你是不是提交的字符串被过滤了
上边可以得到,但不是源码
我想得到
写的XX内容
带标签的源码
你得到的就是带有 html 标记的内容!
只不过你 echo 出来的话,在浏览器上看到的是格式化后的内容。因为 html 总是要被浏览器解释的
你可以查看源代码或输出时加上预格式化标签
这后台模版貌似不错。
输出时加上预格式化标签
是不是有一个函数,可以直接把html标签也一同输出来? 我记得有一个来着
public function content(){
$content = $_POST['myEditor'];;
echo "--------------------------"."
";
echo htmlspecialchars($content);
//echo $content;
}

ThesecrettokeepingaPHP-poweredwebsiterunningsmoothlyunderheavyloadinvolvesseveralkeystrategies:1)ImplementopcodecachingwithOPcachetoreducescriptexecutiontime,2)UsedatabasequerycachingwithRedistolessendatabaseload,3)LeverageCDNslikeCloudflareforservin

You should care about DependencyInjection(DI) because it makes your code clearer and easier to maintain. 1) DI makes it more modular by decoupling classes, 2) improves the convenience of testing and code flexibility, 3) Use DI containers to manage complex dependencies, but pay attention to performance impact and circular dependencies, 4) The best practice is to rely on abstract interfaces to achieve loose coupling.

Yes,optimizingaPHPapplicationispossibleandessential.1)ImplementcachingusingAPCutoreducedatabaseload.2)Optimizedatabaseswithindexing,efficientqueries,andconnectionpooling.3)Enhancecodewithbuilt-infunctions,avoidingglobalvariables,andusingopcodecaching

ThekeystrategiestosignificantlyboostPHPapplicationperformanceare:1)UseopcodecachinglikeOPcachetoreduceexecutiontime,2)Optimizedatabaseinteractionswithpreparedstatementsandproperindexing,3)ConfigurewebserverslikeNginxwithPHP-FPMforbetterperformance,4)

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 English version
Recommended: Win version, supports code prompts!

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Linux new version
SublimeText3 Linux latest version

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.
