{"id":61413,"date":"2024-10-13T10:56:37","date_gmt":"2024-10-13T02:56:37","guid":{"rendered":"https:\/\/server.hk\/cnblog\/61413\/"},"modified":"2024-10-13T10:56:37","modified_gmt":"2024-10-13T02:56:37","slug":"fckeditor%e5%a6%82%e4%bd%95%e9%80%a3%e6%8e%a5%e6%95%b8%e6%93%9a%e5%ba%ab%ef%bc%9f-fckeditor%e9%80%a3%e6%8e%a5%e6%95%b8%e6%93%9a%e5%ba%ab","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/61413\/","title":{"rendered":"FCKeditor\u5982\u4f55\u9023\u63a5\u6578\u64da\u5eab\uff1f (fckeditor\u9023\u63a5\u6578\u64da\u5eab)"},"content":{"rendered":"<h1 id=\"fckeditor%e5%a6%82%e4%bd%95%e9%80%a3%e6%8e%a5%e6%95%b8%e6%93%9a%e5%ba%ab%ef%bc%9f-fckeditor%e9%80%a3%e6%8e%a5%e6%95%b8%e6%93%9a%e5%ba%ab-qGPIGhofrq\">FCKeditor\u5982\u4f55\u9023\u63a5\u6578\u64da\u5eab\uff1f (fckeditor\u9023\u63a5\u6578\u64da\u5eab)<\/h1>\n<p>FCKeditor\u662f\u4e00\u6b3e\u6d41\u884c\u7684\u958b\u6e90WYSIWYG\uff08\u6240\u898b\u5373\u6240\u5f97\uff09\u6587\u672c\u7de8\u8f2f\u5668\uff0c\u5ee3\u6cdb\u61c9\u7528\u65bc\u5404\u7a2eWeb\u61c9\u7528\u7a0b\u5e8f\u4e2d\u3002\u5b83\u7684\u6613\u7528\u6027\u548c\u9748\u6d3b\u6027\u4f7f\u5f97\u958b\u767c\u8005\u80fd\u5920\u8f15\u9b06\u5730\u5c07\u5176\u96c6\u6210\u5230\u81ea\u5df1\u7684\u9805\u76ee\u4e2d\u3002\u672c\u6587\u5c07\u63a2\u8a0e\u5982\u4f55\u5c07FCKeditor\u8207\u6578\u64da\u5eab\u9023\u63a5\uff0c\u4ee5\u4fbf\u7528\u6236\u80fd\u5920\u4fdd\u5b58\u548c\u7ba1\u7406\u5176\u7de8\u8f2f\u7684\u5167\u5bb9\u3002<\/p>\n<h2 id=\"fckeditor%e7%b0%a1%e4%bb%8b-qGPIGhofrq\">FCKeditor\u7c21\u4ecb<\/h2>\n<p>FCKeditor\u6700\u521d\u7531Frederico Caldeira Knabben\u958b\u767c\uff0c\u5f8c\u4f86\u66f4\u540d\u70baCKEditor\u3002\u5b83\u652f\u6301\u591a\u7a2e\u683c\u5f0f\u7684\u6587\u672c\u7de8\u8f2f\uff0c\u5305\u62ecHTML\u3001Markdown\u7b49\uff0c\u4e26\u4e14\u53ef\u4ee5\u8f15\u9b06\u5730\u8207\u5f8c\u7aef\u6280\u8853\u7d50\u5408\u3002\u901a\u904e\u5c07FCKeditor\u8207\u6578\u64da\u5eab\u9023\u63a5\uff0c\u958b\u767c\u8005\u53ef\u4ee5\u5be6\u73fe\u5167\u5bb9\u7684\u6301\u4e45\u5316\u5b58\u5132\uff0c\u9019\u5c0d\u65bc\u9700\u8981\u7528\u6236\u751f\u6210\u5167\u5bb9\u7684\u61c9\u7528\u7a0b\u5e8f\u5c24\u70ba\u91cd\u8981\u3002<\/p>\n<h2 id=\"%e9%80%a3%e6%8e%a5%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84%e5%9f%ba%e6%9c%ac%e6%ad%a5%e9%a9%9f-qGPIGhofrq\">\u9023\u63a5\u6578\u64da\u5eab\u7684\u57fa\u672c\u6b65\u9a5f<\/h2>\n<p>\u8981\u5c07FCKeditor\u9023\u63a5\u5230\u6578\u64da\u5eab\uff0c\u901a\u5e38\u9700\u8981\u4ee5\u4e0b\u5e7e\u500b\u6b65\u9a5f\uff1a<\/p>\n<ul>\n<li>\u8a2d\u7f6e\u6578\u64da\u5eab<\/li>\n<li>\u914d\u7f6eFCKeditor<\/li>\n<li>\u7de8\u5beb\u5f8c\u7aef\u4ee3\u78bc<\/li>\n<li>\u6e2c\u8a66\u9023\u63a5<\/li>\n<\/ul>\n<h3 id=\"1-%e8%a8%ad%e7%bd%ae%e6%95%b8%e6%93%9a%e5%ba%ab-qGPIGhofrq\">1. \u8a2d\u7f6e\u6578\u64da\u5eab<\/h3>\n<p>\u9996\u5148\uff0c\u60a8\u9700\u8981\u5728\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\u4e2d\u5275\u5efa\u4e00\u500b\u6578\u64da\u5eab\u548c\u76f8\u61c9\u7684\u8868\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u7c21\u55ae\u7684MySQL\u6578\u64da\u5eab\u8a2d\u7f6e\u793a\u4f8b\uff1a<\/p>\n<pre><code>CREATE DATABASE fckeditor_db;\nUSE fckeditor_db;\n\nCREATE TABLE content (\n    id INT AUTO_INCREMENT PRIMARY KEY,\n    title VARCHAR(255) NOT NULL,\n    body TEXT NOT NULL,\n    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP\n);<\/code><\/pre>\n<h3 id=\"2-%e9%85%8d%e7%bd%aefckeditor-qGPIGhofrq\">2. \u914d\u7f6eFCKeditor<\/h3>\n<p>\u5728\u60a8\u7684HTML\u9801\u9762\u4e2d\u5f15\u5165FCKeditor\u7684JavaScript\u6587\u4ef6\uff0c\u4e26\u5275\u5efa\u4e00\u500b\u6587\u672c\u7de8\u8f2f\u5668\u5be6\u4f8b\uff1a<\/p>\n<pre><code>&lt;script type=\"text\/javascript\" src=\"fckeditor.js\"&gt;&lt;\/script&gt;\n&lt;textarea name=\"editor1\" id=\"editor1\"&gt;&lt;\/textarea&gt;\n&lt;script type=\"text\/javascript\"&gt;\n    var oFCKeditor = new FCKeditor(\"editor1\");\n    oFCKeditor.BasePath = \"\/fckeditor\/\";\n    oFCKeditor.ReplaceTextarea();\n&lt;\/script&gt;<\/code><\/pre>\n<h3 id=\"3-%e7%b7%a8%e5%af%ab%e5%be%8c%e7%ab%af%e4%bb%a3%e7%a2%bc-qGPIGhofrq\">3. \u7de8\u5beb\u5f8c\u7aef\u4ee3\u78bc<\/h3>\n<p>\u63a5\u4e0b\u4f86\uff0c\u60a8\u9700\u8981\u7de8\u5beb\u5f8c\u7aef\u4ee3\u78bc\u4f86\u8655\u7406\u6578\u64da\u7684\u5b58\u5132\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u4f7f\u7528PHP\u7684\u793a\u4f8b\uff1a<\/p>\n<pre><code>&lt;?php\n$servername = \"localhost\";\n$username = \"username\";\n$password = \"password\";\n$dbname = \"fckeditor_db\";\n\n\/\/ \u5275\u5efa\u9023\u63a5\n$conn = new mysqli($servername, $username, $password, $dbname);\n\n\/\/ \u6aa2\u67e5\u9023\u63a5\nif ($conn-&gt;connect_error) {\n    die(\"Connection failed: \" . $conn-&gt;connect_error);\n}\n\n\/\/ \u7372\u53d6FCKeditor\u7684\u5167\u5bb9\n$title = $_POST['title'];\n$body = $_POST['editor1'];\n\n\/\/ \u63d2\u5165\u6578\u64da\n$sql = \"INSERT INTO content (title, body) VALUES ('$title', '$body')\";\nif ($conn-&gt;query($sql) === TRUE) {\n    echo \"\u65b0\u8a18\u9304\u5275\u5efa\u6210\u529f\";\n} else {\n    echo \"\u932f\u8aa4: \" . $sql . \"&lt;br&gt;\" . $conn-&gt;error;\n}\n\n$conn-&gt;close();\n?&gt;<\/code><\/pre>\n<h3 id=\"4-%e6%b8%ac%e8%a9%a6%e9%80%a3%e6%8e%a5-qGPIGhofrq\">4. \u6e2c\u8a66\u9023\u63a5<\/h3>\n<p>\u6700\u5f8c\uff0c\u60a8\u9700\u8981\u6e2c\u8a66\u6574\u500b\u6d41\u7a0b\u3002\u78ba\u4fddFCKeditor\u80fd\u5920\u6b63\u5e38\u986f\u793a\uff0c\u4e26\u4e14\u5728\u63d0\u4ea4\u8868\u55ae\u5f8c\uff0c\u6578\u64da\u80fd\u5920\u6b63\u78ba\u5730\u5b58\u5132\u5230\u6578\u64da\u5eab\u4e2d\u3002\u60a8\u53ef\u4ee5\u901a\u904e\u5728\u6578\u64da\u5eab\u4e2d\u67e5\u8a62\u4f86\u9a57\u8b49\u6578\u64da\u662f\u5426\u6210\u529f\u63d2\u5165\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-qGPIGhofrq\">\u7e3d\u7d50<\/h2>\n<p>\u901a\u904e\u4ee5\u4e0a\u6b65\u9a5f\uff0c\u60a8\u53ef\u4ee5\u8f15\u9b06\u5730\u5c07FCKeditor\u8207\u6578\u64da\u5eab\u9023\u63a5\uff0c\u5be6\u73fe\u5167\u5bb9\u7684\u6301\u4e45\u5316\u5b58\u5132\u3002\u9019\u5c0d\u65bc\u9700\u8981\u7528\u6236\u751f\u6210\u5167\u5bb9\u7684Web\u61c9\u7528\u7a0b\u5e8f\u4f86\u8aaa\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002\u82e5\u60a8\u9700\u8981\u7a69\u5b9a\u7684\u4f3a\u670d\u5668\u4f86\u904b\u884c\u60a8\u7684\u61c9\u7528\u7a0b\u5e8f\uff0c\u8003\u616e\u4f7f\u7528<a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a>\u6216<a href=\"https:\/\/server.hk\">\u9999\u6e2f\u4f3a\u670d\u5668<\/a>\uff0c\u4ee5\u78ba\u4fdd\u60a8\u7684\u7db2\u7ad9\u6027\u80fd\u548c\u5b89\u5168\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e86\u89e3\u5982\u4f55\u4f7f\u7528FCKeditor\u9023\u63a5\u6578\u64da\u5eab\uff0c\u5be6\u73fe\u6578\u64da\u5b58\u5132\u548c\u7ba1\u7406\uff0c\u63d0\u5347\u7db2\u9801\u7de8\u8f2f\u529f\u80fd\u7684\u9748\u6d3b\u6027\u8207\u6548\u7387\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-61413","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/61413","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=61413"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/61413\/revisions"}],"predecessor-version":[{"id":61414,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/61413\/revisions\/61414"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=61413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=61413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=61413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}