{"id":1315,"date":"2009-06-23T13:01:01","date_gmt":"2009-06-23T05:01:01","guid":{"rendered":"https:\/\/www.wopus.org\/?p=1315"},"modified":"2009-06-23T13:01:01","modified_gmt":"2009-06-23T05:01:01","slug":"wordpress5%e4%b8%aa%e4%b8%8d%e5%b8%b8%e7%94%a8%e7%9a%84%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"https:\/\/wopus.org\/?p=1315","title":{"rendered":"WordPress5\u4e2a\u4e0d\u5e38\u7528\u7684\u51fd\u6570"},"content":{"rendered":"<p><strong>1. wp_mail()<\/strong><br \/>\nwp_mail()\u57fa\u672c\u4e0a\u662f\u4e00\u4e2a\u8d85\u7ea7\u7b80\u5355\u7684\u51fd\u6570\uff0c\u5141\u8bb8\u4f60\u901a\u8fc7\u4e00\u4e9b\u7b80\u5355\u7684\u4ee3\u7801\u8f7b\u677e\u5730\u5411\u4efb\u4f55\u4eba\u53d1\u9001\u7535\u5b50\u90ae\u4ef6\u3002\u4f8b\u5982\uff1a<\/p>\n<blockquote><p>< ?php\n$to = \u2018user@example.com\u2019;\n$subject = \u2018Hello from my blog!\u2019;\n$message = \u2018Check it out \u2014 my blog is emailing you!\u2019\n\n$mail = wp_mail($to, $subject, $message);\n\nif($mail) echo \u2018Your message has been sent!\u2019;\nelse echo \u2018There was a problem sending your message. Please try again.\u2019;\n?><\/p><\/blockquote>\n<p>\u4f60\u53ef\u4ee5\u6307\u5b9a\u7b2c\u4e09\u548c\u7b2c\u56db\u4e2a\u53c2\u6570\uff0c$headers \u548c $attachments\u3002\u8fd9\u4e2a\u51fd\u6570\u80fd\u591f\u5b8c\u6210\u4efb\u4f55\u4f60\u6240\u80fd\u60f3\u5230\u7684\u7e41\u91cd\u4efb\u52a1\u3002<\/p>\n<p>\u4f60\u53ef\u4ee5\u67e5\u770b\u51fd\u6570\u53c2\u8003<a href=\"http:\/\/codex.wordpress.org\/Function_Reference\/wp_mail\" target=\"_blank\">via<\/a>\uff0c\u6216\u8005\u67e5\u770b\u51fd\u6570\u6e90\u4ee3\u7801<a href=\"http:\/\/phpxref.com\/xref\/wordpress\/wp-includes\/general-template.php.source.html#l121\" target=\"_blank\">via<\/a>\uff08\u5f3a\u70c8\u5efa\u8bae\uff09\u3002<\/p>\n<p><strong>2. wp_loginout()<\/strong><\/p>\n<blockquote><p>\u8fd9\u4e2a\u51fd\u6570\u4f7f\u6211\u4eec\u80fd\u591f\u5728\u4e3b\u9898\u4e2d\u663e\u793a\u201c\u767b\u5f55\u201d\u94fe\u63a5\uff0c\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u8f7b\u6613\u7684\u767b\u5f55\uff0c\u800c\u65e0\u987b\u624b\u52a8\u8f93\u5165\/wp-admin\/ \u6216\/wp-login.php \u94fe\u63a5\u3002\u4f46\u662f\uff0c\u5b83\u4e0d\u4ec5\u4ec5\u5982\u6b64\uff0c\u5982\u679c\u6211\u4eec\u5df2\u7ecf\u767b\u5f55\uff0c\u5b83\u5c06\u663e\u793a\u201c\u6ce8\u9500\u201d\u94fe\u63a5\u800c\u4e0d\u518d\u662f\u201c\u767b\u5f55\u201d\u94fe\u63a5\uff0c\u800c\u4f7f\u6211\u4eec\u65e0\u9700\u8bbf\u95ee\u63a7\u5236\u53f0\u5c31\u80fd\u591f\u767b\u51fa\u8d26\u6237\u3002<\/p>\n<p>\u8fd9\u4e2a\u51fd\u6570\u5bf9\u4e8e\u4e3b\u9898\u4f5c\u8005\u975e\u5e38\u6709\u7528\uff0c\u56e0\u4e3a\u5b83\u4e3a\u4f60\u5efa\u7acb\u4e86\u6240\u6709\u7684\u903b\u8f91\u3002\u5982\u679c\u4f60\u4ecd\u7136\u624b\u52a8\u6dfb\u52a0\u767b\u5f55\u6216\u6ce8\u9500\uff0c\u4f60\u53ea\u662f\u5728\u6d6a\u8d39\u65f6\u95f4\u3002\u4e0d\u8981\u778e\u5fd9\uff0c\u4f7f\u7528<strong>wp_loginout()<\/strong>\u3002<\/p>\n<p>\u4f60\u53ef\u4ee5\u67e5\u770b\u6a21\u677f\u6807\u7b7e\u53c2\u8003<a href=\"http:\/\/codex.wordpress.org\/Template_Tags\/wp_loginout\" target=\"_blank\">via<\/a>\uff0c\u6216\u8005\u67e5\u770b\u51fd\u6570\u6e90\u4ee3\u7801<a href=\"http:\/\/phpxref.com\/xref\/wordpress\/wp-includes\/general-template.php.source.html#l121\" target=\"_blank\">via<\/a>\u3002<\/p><\/blockquote>\n<p><strong>3. clean_url()<\/strong><\/p>\n<blockquote><p>\u8fd9\u4e2a\u51fd\u6570\u8f93\u5165URL\u5e76\u6d4b\u8bd5\u5b83\u7684\u7ed3\u6784\u662f\u5426\u6b63\u786e\u3002\u5982\u679c\u94fe\u63a5\u524d\u9762\u7f3a\u5c11http:\/\/\u5b83\u53ef\u4ee5\u81ea\u52a8\u6dfb\u52a0\uff0c\u8f6c\u6362\u7b26\u53f7\u4e3a\u6b63\u786e\u7684HTML\uff0c\u548c\u5176\u4ed6\u63aa\u65bd\u7528\u6765\u89e3\u51b3\u7ed3\u6784\u4e0d\u826f\u7684\u7f51\u5740\u3002<\/p>\n<p>\u6709\u7528\u7684\u60c5\u51b5\u8fd8\u6709\u5f88\u591a\uff0c\u4e00\u4e2a\u6211\u8ba4\u4e3a\u6709\u7528\u7684\u662f\u5728\u4e3b\u9898\u6216\u63d2\u4ef6\u7684\u8bbe\u7f6e\u9875\u9762\uff0c\u53ef\u4ee5\u4e0d\u5fc5\u8981\u6c42\u7528\u6237\u8f93\u5165\u7684\u94fe\u63a5\u5fc5\u987b\u5305\u62echttp:\/\/\u3002\u5982\u679c\u8fd9\u4e2a\u51fd\u6570\u6ca1\u6709\u5176\u4ed6\u7684\u4f5c\u7528\uff0c\u90a3\u5bf9\u4e8e\u6211\u6765\u8bf4\u8fd9\u4e00\u4f5c\u7528\u5c31\u662f\u6709\u7528\u7684\u3002<\/p>\n<p>\u4f60\u53ef\u4ee5\u67e5\u770b\u6a21\u677f\u6807\u7b7e\u53c2\u8003<a href=\"http:\/\/codex.wordpress.org\/Function_Reference\/wpautop\" target=\"_blank\">via<\/a>\uff0c\u6216\u8005\u67e5\u770b\u51fd\u6570\u6e90\u4ee3\u7801<a href=\"http:\/\/phpxref.com\/xref\/wordpress\/wp-includes\/general-template.php.source.html#l121\" target=\"_blank\">via<\/a>\u3002<\/p><\/blockquote>\n<p><strong>4. wpautop()<\/strong><\/p>\n<blockquote><p>\u8fd9\u4e2a\u51fd\u6570\u7528\u6765\u8f6c\u6362\u6362\u884c\u7b26\u5b57\u7b26\u4e32\u4e3a<br \/>\u6807\u8bb0\uff0c\u5e76\u628a\u53cc\u6362\u884c\u7b26\u4f5c\u4e3a\u4e00\u4e2a\u65b0\u7684\u6bb5\u843d\u7684\u5f00\u59cb\uff0c\u5728\u524d\u4e00\u6bb5\u52a0\u5165\uff0c\u5e76\u5728\u65b0\u7684\u6bb5\u843d\u52a0\u4e0a<\/p>\n<p>\u3002\u5b83\u8fd8\u8d1f\u8d23\u5173\u95ed\u6bb5\u843d\u6807\u7b7e\uff0c\u6240\u4ee5\u683c\u5f0f\u90fd\u662f\u6b63\u786e\u7684\u3002<\/p>\n<p>\u5982\u679c\u4f60\u66fe\u7ecf\u50a8\u5b58\u4e86\u5b57\u7b26\u4e32\u6587\u5b57\u5728\u6570\u636e\u5e93\u4e2d\uff0c\u73b0\u5728\u4f60\u9700\u8981\u5728\u7f51\u7ad9\u524d\u7aef\uff08\u9875\u9762\uff09\u5c55\u793a\u8fd9\u4e9b\u5185\u5bb9\u3002\u4f46\u662f\u4f60\u60f3\u77e5\u9053\u5982\u4f55\u628a\u8fd9\u4e9b\u6362\u884c\u7b26\u8f93\u51fa\u4e3a\u6709\u6548\u7684Html\uff0c\u8fd9\u4e2a\u51fd\u6570\u5c31\u5b9e\u73b0\u8fd9\u6837\u7684\u529f\u80fd\u3002\u4e8b\u5b9e\u4e0a\uff0c\u8fd9\u4e2a\u51fd\u6570\u5728\u8f93\u51fa<strong>the_content()<\/strong>\u65f6\u7528\u6765\u683c\u5f0f\u5316\u5e16\u5b50\u7684\u3002<\/p>\n<p>\u4f60\u53ef\u4ee5\u67e5\u770b\u6a21\u677f\u6807\u7b7e\u53c2\u8003<a href=\"http:\/\/codex.wordpress.org\/Function_Reference\/wpautop\" target=\"_blank\">via<\/a>\uff0c\u6216\u8005\u67e5\u770b\u51fd\u6570\u6e90\u4ee3\u7801<a href=\"http:\/\/phpxref.com\/xref\/wordpress\/wp-includes\/formatting.php.source.html#l102\" target=\"_blank\">via<\/a>\u3002<\/p>\n<\/blockquote>\n<p><strong>5. wp_rss() \/ get_rss()<\/strong><br \/>\n\u8fd9\u4e2a\u51fd\u6570\u53ef\u4ee5\u4ece\u4e00\u4e2aRSS Feed\u4e2d\u62bd\u53d6\u6570\u636e\uff0c\u901a\u8fc7\u4f60\u7684\u5904\u7406\uff0c\u663e\u793a\u4e3a\u94fe\u63a5\u5217\u8868\u3002<\/p>\n<p>\u6211\u5728\u5f88\u591a\u4e2a\u5ba2\u6237\u7684\u7f51\u7ad9\u4e0a\u4f7f\u7528\u4e86\u8fd9\u4e2a\u51fd\u6570\uff0c\u4ed6\u4eec\u9700\u8981\u6211\u5728\u7f51\u7ad9\u7684\u4e0a\u663e\u793a\u6765\u6e90\u4e8e\u5176\u4ed6\u7f51\u7ad9\u7684\u6545\u4e8b\u3002\u6240\u6709\u4f60\u9700\u8981\u505a\u7684\u662f\u63d0\u4f9b\u4e00\u4e2aRSS Feed\u5730\u5740\uff0c\u51fd\u6570\u5c06\u5e2e\u4f60\u5b8c\u6210\u8fd9\u4e9b\u56f0\u96be\u7684\u5de5\u4f5c\u3002<\/p>\n<p>\u524d\u63d0\u6761\u4ef6\u662f\u5728\u4f60\u4f7f\u7528\u8fd9\u4e9b\u51fd\u6570\u524d\u5fc5\u987b\u5305\u542b\u8fd9\u4e9bPHP\u4ee3\u7801\uff0c\u5b83\u4ec5\u4ec5\u53ea\u662f\u989d\u5916\u7684\u4e00\u884c\u4ee3\u7801\uff1a<\/p>\n<blockquote><p>< ?php\ninclude_once(ABSPATH . WPINC . \u2018\/rss.php\u2019); \/\/ < \u2014 this is the include call\nwp_rss(\u2019http:\/\/example.com\/rss\/feed\/goes\/here\u2019, 5); \/\/ <\u2013 this is the function\n?><\/p><\/blockquote>\n<p>\u4f60\u53ef\u4ee5\u67e5\u770b\u6a21\u677f\u6807\u7b7e\u53c2\u8003 wp_rss() <a href=\"http:\/\/codex.wordpress.org\/Function_Reference\/wp_rss\" target=\"_blank\">via<\/a> \u6216get_rss() <a href=\"http:\/\/codex.wordpress.org\/Function_Reference\/get_rss\" target=\"_blank\">via<\/a>\uff0c\u6216\u8005\u67e5\u770b\u51fd\u6570\u6e90\u4ee3\u7801<a href=\"http:\/\/phpxref.com\/xref\/wordpress\/wp-includes\/rss.php.source.html#l875\" target=\"_blank\">via<\/a>\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. wp_mail() wp_mail()\u57fa\u672c\u4e0a\u662f\u4e00\u4e2a\u8d85\u7ea7\u7b80\u5355\u7684\u51fd\u6570\uff0c\u5141\u8bb8\u4f60\u901a\u8fc7\u4e00\u4e9b\u7b80\u5355\u7684\u4ee3\u7801\u8f7b\u677e\u5730\u5411\u4efb\u4f55\u4eba\u53d1\u9001\u7535\u5b50\u90ae\u4ef6\u3002\u4f8b\u5982\uff1a < ?php $to = \u2018user@example.com\u2019; $subject = \u2018Hello from my blog!\u2019; $message = \u2018Check it out \u2014 my blog is emailing you!\u2019 $mail = wp_mail($to, $subject, $message); if($mail) echo \u2018Your message has been sent!\u2019; else echo \u2018There was a problem sending your message. Please try again.\u2019; ?> \u4f60\u53ef\u4ee5\u6307\u5b9a\u7b2c\u4e09\u548c\u7b2c\u56db\u4e2a\u53c2\u6570\uff0c$headers \u548c $attachments\u3002\u8fd9\u4e2a\u51fd\u6570\u80fd\u591f\u5b8c\u6210\u4efb\u4f55\u4f60\u6240\u80fd\u60f3\u5230\u7684\u7e41\u91cd\u4efb\u52a1\u3002 \u4f60\u53ef\u4ee5\u67e5\u770b\u51fd\u6570\u53c2\u8003via\uff0c\u6216\u8005\u67e5\u770b\u51fd\u6570\u6e90\u4ee3\u7801via\uff08\u5f3a\u70c8\u5efa\u8bae\uff09\u3002 2. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[313,557],"class_list":["post-1315","post","type-post","status-publish","format-standard","hentry","category-tech","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/wopus.org\/index.php?rest_route=\/wp\/v2\/posts\/1315","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wopus.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wopus.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wopus.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wopus.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1315"}],"version-history":[{"count":0,"href":"https:\/\/wopus.org\/index.php?rest_route=\/wp\/v2\/posts\/1315\/revisions"}],"wp:attachment":[{"href":"https:\/\/wopus.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1315"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wopus.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1315"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wopus.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1315"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}