{"id":31573,"date":"2024-11-25T11:56:45","date_gmt":"2024-11-25T03:56:45","guid":{"rendered":"https:\/\/fwq.ai\/blog\/31573\/"},"modified":"2024-11-25T11:56:45","modified_gmt":"2024-11-25T03:56:45","slug":"phpcms-%e7%94%a8%e7%9a%84%e6%98%af%e5%93%aa%e4%b8%aa%e7%bc%96%e8%be%91%e5%99%a8%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/31573\/","title":{"rendered":"PHPCMS \u7528\u7684\u662f\u54ea\u4e2a\u7f16\u8f91\u5668\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/046\/5eec856ea0040487.jpg\" class=\"aligncenter\" title=\"PHPCMS \u7528\u7684\u662f\u54ea\u4e2a\u7f16\u8f91\u5668\uff1f\u63d2\u56fe\" alt=\"PHPCMS \u7528\u7684\u662f\u54ea\u4e2a\u7f16\u8f91\u5668\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>PHPCMS \u7528\u7684\u662f\u54ea\u4e2a\u7f16\u8f91\u5668\uff1f<\/strong><\/p>\n<p>PHPCMS\u7528\u7684\u662fCKEditor\u7f16\u8f91\u5668\uff0cCKEditor\u662f\u65b0\u4e00\u4ee3\u7684FCKeditor\uff0c\u662f\u4e00\u4e2a\u91cd\u65b0\u5f00\u53d1\u7684\u7248\u672c\uff0c\u8be5\u7f16\u8f91\u5668\u662f\u5168\u7403\u6700\u4f18\u79c0\u7684\u7f51\u9875\u5728\u7ebf\u6587\u5b57\u7f16\u8f91\u5668\u4e4b\u4e00\uff0c\u56e0\u5176\u60ca\u4eba\u7684\u6027\u80fd\u4e0e\u53ef\u6269\u5c55\u6027\u800c\u5e7f\u6cdb\u7684\u88ab\u8fd0\u7528\u4e8e\u5404\u5927\u7f51\u7ad9\u3002<strong><br \/><\/strong><\/p>\n<p><strong>\u96c6\u6210&nbsp;CKEditor<\/strong><\/p>\n<p>\u6709\u82e5\u5e72\u4e2a\u65b9\u5f0f\u80fd\u5c06CKEditor\u96c6\u6210\u5230\u4f60\u7684\u7f51\u9875\u4e2d\uff0c\u5728\u8fd9\u91cc\u4ecb\u7ecd\u6700\u5e38\u7528\u7684\u5b9e\u73b0\u65b9\u6cd5\u3002<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u7b2c\u4e00\u6b65\uff1a\u8f7d\u5165CKEditor<\/p>\n<p>CKEditor \u662f\u4e00\u4e2aJavaScript \u5e94\u7528\u7a0b\u5e8f\uff0c\u4f60\u53ea\u9700\u8981\u5728\u4f60\u7684\u7f51\u9875\u4e2d\u5305\u542b\u4e00\u4e2a\u6587\u4ef6\u5f15\u7528\u5c31\u80fd\u52a0\u8f7d\u5b83\u3002<\/p>\n<p>\u5982\u679c\u4f60\u5df2\u7ecf\u5c06CKEditor\u5b89\u88c5\u5728\u4e86\u4f60\u7f51\u7ad9\u7684\u201cckeditor\u201d\u76ee\u5f55\uff0c\u4f60\u53ef\u53c2\u7167\u5982\u4e0b\u793a\u4f8b\uff1a<\/p>\n<pre>\n...\n&lt;script&gt;&lt;\/script&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7528\u4ee5\u4e0a\u65b9\u5f0f\u52a0\u8f7d\uff0cCKEditor JavaScript API \u5c31\u51c6\u5907\u5c31\u7eea\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e86\u3002<\/p>\n<p>\u7b2c\u4e8c\u6b65\uff1a\u521b\u5efa\u4e00\u4e2a\u7f16\u8f91\u5668\u5b9e\u4f8b<\/p>\n<p>CKEditor\u5c31\u50cf\u4e00\u4e2a\u5728\u4f60\u7f51\u9875\u4e2d\u7684\u6587\u672c\u533a\u57df\uff08textarea\uff09\u4e00\u6837\u5de5\u4f5c\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e00\u4e2a\u7b80\u5355\u6613\u5199\u7684\u7528\u6237\u754c\u9762\u3001\u7248\u5f0f\u548c\u4e30\u5bcc\u7684\u6587\u5b57\u8f93\u5165\u533a\u57df\u3002\u4f46\u7528\u6587\u672c\u533a\u57df\u8981\u5b9e\u73b0\u540c\u6837\u7684\u6548\u679c\uff0c\u5e76\u4e0d\u5bb9\u6613\uff0c\u5b83\u9700\u8981\u7528\u6237\u8f93\u5165html\u4ee3\u7801\u3002<\/p>\n<p>\u4f46\u662f\uff0c\u5b9e\u9645\u4e0a\uff0cCKEditor\u4ecd\u7136\u662f\u4f7f\u7528\u4e00\u4e2a\u6587\u672c\u533a\u57df\u6765\u4f20\u9012\u5b83\u7684\u6570\u636e\u5230\u670d\u52a1\u5668\u4e0a\uff0c\u8fd9\u4e2a\u6587\u672c\u533a\u57df\u5bf9\u4f7f\u7528\u8005\u6765\u8bf4\u662f\u4e0d\u53ef\u89c1\u7684\u3002\u6240\u4ee5\uff0c\u4f60\u5fc5\u9700\u521b\u5efa\u5e76\u7f16\u8f91\u4e00\u4e2a\u5b9e\u4f8b,\u9996\u5148\u521b\u5efa\u4e00\u4e2a\u5b9e\u4f8b\uff1a<\/p>\n<pre>&lt;textarea&gt;&lt;\/textarea&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6ce8\u610f\uff0c\u5982\u679c\u4f60\u60f3\u8981\u52a0\u8f7d\u4e00\u4e9b\u6570\u636e\u5230\u7f16\u8f91\u5668\u4e2d\uff0c\u4f8b\u5982\u4ece\u6570\u636e\u5e93\u4e2d\u8bfb\u51fa\u6570\u636e\uff0c\u53ea\u9700\u8981\u628a\u6570\u636e\u653e\u5728\u6587\u672c\u533a\u57df\uff08textarea\uff09\u5185\u5c31\u53ef\u4ee5\u4e86\uff0c\u5c31\u50cf\u4e0a\u9762\u7684\u4f8b\u5b50\u4e00\u6837\u3002\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u5df2\u7ecf\u5c06\u6587\u672c\u533a\u57df\uff08textarea\uff09\u547d\u540d\u8fd9\u201ceditor1\u201d\u3002\u5f53\u63a5\u6536POST\u63d0\u4ea4\u7684\u6570\u636e\u65f6\uff0c\u8fd9\u4e2a\u540d\u5b57\u5c06\u88ab\u7528\u5728\u670d\u52a1\u5668\u64cd\u4f5c\u3002\u5f00\u59cb\u4f7f\u7528CKEditor Javascript API,\u6211\u4eec\u7528\u4e00\u4e2a\u7f16\u8f91\u5668\u5b9e\u4f8b\u6765\u201c\u66ff\u6362\uff08replace\uff09\u201d\u8fd9\u4e2a\u666e\u901a\u7684\u6587\u672c\u533a\u57df\uff08textarea\uff09\uff0c\u4e3a\u6b64\uff0c\u5fc5\u987b\u52a0\u5165\u5982\u4e0b\u4e00\u6bb5JavaScript\u4ee3\u7801\uff1a<\/p>\n<pre>&lt;script&gt;\nCKEDITOR.replace( &#039;editor1&#039; );\n&lt;\/script&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4e0a\u9762\u7684\u811a\u672c\u5757\u53ea\u80fd\u5305\u542b\u5728\u7f51\u9875\u7684\u6807\u7b7e\u4e4b\u540e\u3002\u4e5f\u53ef\u4ee5\u5728\u6807\u7b7e\u5185\u8fd0\u884c\u8fd9\u4e2a\u66ff\u6362\u8fc7\u7a0b\uff0c\u4f46\u662f\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4f60\u5fc5\u987b\u786e\u5b9aDOM\u5df2\u7ecf\u8f7d\u5165\u5b8c\u6bd5\uff0c\u901a\u5e38\u53ef\u4ee5\u5199\u5728window.onload\u4e8b\u4ef6\u91cc\u9762\uff08\u8fd9\u65f6DOM\u80af\u5b9a\u5df2\u7ecf\u8f7d\u5165\u5b8c\u6bd5\u5566\uff09\uff1a<\/p>\n<pre>&lt;script&gt;\nwindow.onload = function()\n{\nCKEDITOR.replace( &#039;editor1&#039; );\n};\n&lt;\/script&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7b2c\u4e09\u6b65\uff1a\u4fdd\u5b58\u7f16\u8f91\u5668\u5185\u5bb9\u6570\u636e<\/p>\n<p>\u6309\u7167\u5148\u524d\u7684\u63cf\u8ff0\uff0c\u7f16\u8f91\u5668\u6b63\u5982\u4e00\u4e2a\u6587\u672c\u533a\u57df\uff08textarea\uff09\u4e00\u6837\u5de5\u4f5c\uff0c\u6240\u4ee5\uff0c\u5f53\u63d0\u4ea4\u4e00\u4e2a\u5305\u542b\u4e00\u4e2a\u7f16\u8f91\u5668\u5b9e\u4f8b\u7684\u8868\u5355\u65f6\uff0c\u4ed6\u7684\u6570\u636e\u4e5f\u5c06\u662f\u5f88\u7b80\u5355\u7684\u4f20\u9012\uff0c\u7528\u6587\u672c\u533a\u57df\uff08textarea\uff09\u7684\u540d\u79f0\u4f5c\u4e3a\u5065\u540d\u6765\u63a5\u6536\u6570\u636e\u3002\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u6309\u7167\u4e0a\u9762\u7684\u4f8b\u5b50\uff0c\u5728PHP\u4e2d\u6211\u4eec\u9700\u8981\u50cf\u8fd9\u6837\u6765\u5904\u7406\u6570\u636e\uff1a<\/p>\n<pre>&lt;?php $editor_data = $_POST[ &#039;editor1&#039; ];\n?&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5ba2\u6237\u7aef\u6570\u636e\u5904\u7406 \u4e00\u4e9b\u7528\u5e94\u4e2d\uff08\u5982ajax\u5e94\u7528\uff09\u9700\u8981\u5728\u5ba2\u6237\u7aef\u5904\u7406\u5b8c\u6240\u6709\u7684\u6570\u636e\uff0c\u7136\u540e\u7528\u5b83\u81ea\u5df1\u7684\u65b9\u5f0f\u5411\u670d\u52a1\u5668\u53d1\u9001\u6570\u636e\uff0c\u5728\u8fd9\u4e9b\u60c5\u51b5\u4e0b\uff0c\u4f7f\u7528CKEditor API\u5c31\u8db3\u4ee5\u8f7b\u677e\u83b7\u53d6\u7f16\u8f91\u5668\u5b9e\u4f8b\u4e2d\u7684\u5185\u5bb9\u3002\u4f8b \u5982\uff1a<\/p>\n<pre>&lt;script&gt;\nvar editor_data = CKEDITOR.instances.editor1.getData();\n&lt;\/script&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<blockquote><p>\n  \u63a8\u8350\u6559\u7a0b\uff1a\u300aPHPCMS\u6559\u7a0b\u300b\n<\/p><\/blockquote>\n<p>\u4ee5\u4e0a\u5c31\u662fPHPCMS \u7528\u7684\u662f\u54ea\u4e2a\u7f16\u8f91\u5668\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHPCMS \u7528\u7684\u662f\u54ea\u4e2a\u7f16\u8f91\u5668\uff1f PHPCMS\u7528\u7684\u662fCKEditor\u7f16\u8f91\u5668\uff0cCKEditor\u662f\u65b0\u4e00\u4ee3\u7684FCKeditor\uff0c\u662f\u4e00\u4e2a\u91cd\u65b0\u5f00\u53d1\u7684\u7248\u672c\uff0c\u8be5\u7f16\u8f91\u5668\u662f\u5168\u7403\u6700\u4f18\u79c0\u7684\u7f51\u9875\u5728\u7ebf\u6587\u5b57\u7f16\u8f91\u5668\u4e4b\u4e00\uff0c\u56e0\u5176\u60ca\u4eba\u7684\u6027\u80fd\u4e0e\u53ef\u6269\u5c55\u6027\u800c\u5e7f\u6cdb\u7684\u88ab\u8fd0\u7528\u4e8e\u5404\u5927\u7f51\u7ad9\u3002 \u96c6\u6210&nbsp;CKEditor \u6709\u82e5\u5e72\u4e2a\u65b9\u5f0f\u80fd\u5c06CKEditor\u96c6\u6210\u5230\u4f60\u7684\u7f51\u9875\u4e2d\uff0c\u5728\u8fd9\u91cc\u4ecb\u7ecd\u6700\u5e38\u7528\u7684\u5b9e\u73b0\u65b9\u6cd5\u3002 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u7b2c\u4e00\u6b65\uff1a\u8f7d\u5165CKEditor CKEditor \u662f\u4e00\u4e2aJavaScript \u5e94\u7528\u7a0b\u5e8f\uff0c\u4f60\u53ea\u9700\u8981\u5728\u4f60\u7684\u7f51\u9875\u4e2d\u5305\u542b\u4e00\u4e2a\u6587\u4ef6\u5f15\u7528\u5c31\u80fd\u52a0\u8f7d\u5b83\u3002 \u5982\u679c\u4f60\u5df2\u7ecf\u5c06CKEditor\u5b89\u88c5\u5728\u4e86\u4f60\u7f51\u7ad9\u7684\u201cckeditor\u201d\u76ee\u5f55\uff0c\u4f60\u53ef\u53c2\u7167\u5982\u4e0b\u793a\u4f8b\uff1a &#8230; &lt;script&gt;&lt;\/script&gt; \u767b\u5f55\u540e\u590d\u5236 \u7528\u4ee5\u4e0a\u65b9\u5f0f\u52a0\u8f7d\uff0cCKEditor JavaScript API \u5c31\u51c6\u5907\u5c31\u7eea\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e86\u3002 \u7b2c\u4e8c\u6b65\uff1a\u521b\u5efa\u4e00\u4e2a\u7f16\u8f91\u5668\u5b9e\u4f8b CKEditor\u5c31\u50cf\u4e00\u4e2a\u5728\u4f60\u7f51\u9875\u4e2d\u7684\u6587\u672c\u533a\u57df\uff08textarea\uff09\u4e00\u6837\u5de5\u4f5c\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e00\u4e2a\u7b80\u5355\u6613\u5199\u7684\u7528\u6237\u754c\u9762\u3001\u7248\u5f0f\u548c\u4e30\u5bcc\u7684\u6587\u5b57\u8f93\u5165\u533a\u57df\u3002\u4f46\u7528\u6587\u672c\u533a\u57df\u8981\u5b9e\u73b0\u540c\u6837\u7684\u6548\u679c\uff0c\u5e76\u4e0d\u5bb9\u6613\uff0c\u5b83\u9700\u8981\u7528\u6237\u8f93\u5165html\u4ee3\u7801\u3002 \u4f46\u662f\uff0c\u5b9e\u9645\u4e0a\uff0cCKEditor\u4ecd\u7136\u662f\u4f7f\u7528\u4e00\u4e2a\u6587\u672c\u533a\u57df\u6765\u4f20\u9012\u5b83\u7684\u6570\u636e\u5230\u670d\u52a1\u5668\u4e0a\uff0c\u8fd9\u4e2a\u6587\u672c\u533a\u57df\u5bf9\u4f7f\u7528\u8005\u6765\u8bf4\u662f\u4e0d\u53ef\u89c1\u7684\u3002\u6240\u4ee5\uff0c\u4f60\u5fc5\u9700\u521b\u5efa\u5e76\u7f16\u8f91\u4e00\u4e2a\u5b9e\u4f8b,\u9996\u5148\u521b\u5efa\u4e00\u4e2a\u5b9e\u4f8b\uff1a &lt;textarea&gt;&lt;\/textarea&gt; \u767b\u5f55\u540e\u590d\u5236 \u6ce8\u610f\uff0c\u5982\u679c\u4f60\u60f3\u8981\u52a0\u8f7d\u4e00\u4e9b\u6570\u636e\u5230\u7f16\u8f91\u5668\u4e2d\uff0c\u4f8b\u5982\u4ece\u6570\u636e\u5e93\u4e2d\u8bfb\u51fa\u6570\u636e\uff0c\u53ea\u9700\u8981\u628a\u6570\u636e\u653e\u5728\u6587\u672c\u533a\u57df\uff08textarea\uff09\u5185\u5c31\u53ef\u4ee5\u4e86\uff0c\u5c31\u50cf\u4e0a\u9762\u7684\u4f8b\u5b50\u4e00\u6837\u3002\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u5df2\u7ecf\u5c06\u6587\u672c\u533a\u57df\uff08textarea\uff09\u547d\u540d\u8fd9\u201ceditor1\u201d\u3002\u5f53\u63a5\u6536POST\u63d0\u4ea4\u7684\u6570\u636e\u65f6\uff0c\u8fd9\u4e2a\u540d\u5b57\u5c06\u88ab\u7528\u5728\u670d\u52a1\u5668\u64cd\u4f5c\u3002\u5f00\u59cb\u4f7f\u7528CKEditor Javascript API,\u6211\u4eec\u7528\u4e00\u4e2a\u7f16\u8f91\u5668\u5b9e\u4f8b\u6765\u201c\u66ff\u6362\uff08replace\uff09\u201d\u8fd9\u4e2a\u666e\u901a\u7684\u6587\u672c\u533a\u57df\uff08textarea\uff09\uff0c\u4e3a\u6b64\uff0c\u5fc5\u987b\u52a0\u5165\u5982\u4e0b\u4e00\u6bb5JavaScript\u4ee3\u7801\uff1a &lt;script&gt; CKEDITOR.replace( &#039;editor1&#039; ); &lt;\/script&gt; \u767b\u5f55\u540e\u590d\u5236 \u4e0a\u9762\u7684\u811a\u672c\u5757\u53ea\u80fd\u5305\u542b\u5728\u7f51\u9875\u7684\u6807\u7b7e\u4e4b\u540e\u3002\u4e5f\u53ef\u4ee5\u5728\u6807\u7b7e\u5185\u8fd0\u884c\u8fd9\u4e2a\u66ff\u6362\u8fc7\u7a0b\uff0c\u4f46\u662f\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4f60\u5fc5\u987b\u786e\u5b9aDOM\u5df2\u7ecf\u8f7d\u5165\u5b8c\u6bd5\uff0c\u901a\u5e38\u53ef\u4ee5\u5199\u5728window.onload\u4e8b\u4ef6\u91cc\u9762\uff08\u8fd9\u65f6DOM\u80af\u5b9a\u5df2\u7ecf\u8f7d\u5165\u5b8c\u6bd5\u5566\uff09\uff1a &lt;script&gt; window.onload = function() { CKEDITOR.replace( &#039;editor1&#039; ); }; &lt;\/script&gt; \u767b\u5f55\u540e\u590d\u5236 \u7b2c\u4e09\u6b65\uff1a\u4fdd\u5b58\u7f16\u8f91\u5668\u5185\u5bb9\u6570\u636e \u6309\u7167\u5148\u524d\u7684\u63cf\u8ff0\uff0c\u7f16\u8f91\u5668\u6b63\u5982\u4e00\u4e2a\u6587\u672c\u533a\u57df\uff08textarea\uff09\u4e00\u6837\u5de5\u4f5c\uff0c\u6240\u4ee5\uff0c\u5f53\u63d0\u4ea4\u4e00\u4e2a\u5305\u542b\u4e00\u4e2a\u7f16\u8f91\u5668\u5b9e\u4f8b\u7684\u8868\u5355\u65f6\uff0c\u4ed6\u7684\u6570\u636e\u4e5f\u5c06\u662f\u5f88\u7b80\u5355\u7684\u4f20\u9012\uff0c\u7528\u6587\u672c\u533a\u57df\uff08textarea\uff09\u7684\u540d\u79f0\u4f5c\u4e3a\u5065\u540d\u6765\u63a5\u6536\u6570\u636e\u3002\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u6309\u7167\u4e0a\u9762\u7684\u4f8b\u5b50\uff0c\u5728PHP\u4e2d\u6211\u4eec\u9700\u8981\u50cf\u8fd9\u6837\u6765\u5904\u7406\u6570\u636e\uff1a &lt;?php $editor_data = $_POST[ &#039;editor1&#039; ]; ?&gt; \u767b\u5f55\u540e\u590d\u5236 \u5ba2\u6237\u7aef\u6570\u636e\u5904\u7406 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-31573","post","type-post","status-publish","format-standard","hentry","category-cms"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31573","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=31573"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31573\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=31573"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=31573"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=31573"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}