﻿{"id":146,"date":"2020-06-05T23:45:22","date_gmt":"2020-06-05T15:45:22","guid":{"rendered":"https:\/\/byy3.com\/?p=146"},"modified":"2022-09-19T06:45:14","modified_gmt":"2022-09-18T22:45:14","slug":"%e4%b8%80%e6%8b%9b%e6%b7%bb%e5%8a%a0wordpress%e5%90%8e%e5%8f%b0%e7%99%bb%e5%bd%95%e9%aa%8c%e8%af%81%e7%a0%81","status":"publish","type":"post","link":"https:\/\/byy3.com\/?p=146","title":{"rendered":"\u4e00\u62db\u6dfb\u52a0WordPress\u540e\u53f0\u767b\u5f55\u9a8c\u8bc1\u7801"},"content":{"rendered":"\r\n<p>&nbsp;<\/p>\r\n<p>\u5c06\u4e0a\u9762\u8fd9\u4e00\u6bb5\u4ee3\u7801\u590d\u5236\u5230Wordpress\u6a21\u677f\u51fd\u6570functions.php\u6587\u4ef6\u5e95\u90e8\u5373\u53ef\u5b9e\u73b0\u6dfb\u52a0\u540e\u53f0\u767b\u5f55\u8f93\u5165\u9a8c\u8bc1\u7801\u529f\u80fd\u3002<\/p>\r\n<p><br \/>\/\/\u540e\u53f0\u767b\u9646\u6570\u5b66\u9a8c\u8bc1\u7801\u5f00\u59cb<br \/>function myplugin_add_login_fields() {<br \/>\/\/\u83b7\u53d6\u4e24\u4e2a\u968f\u673a\u6570, \u8303\u56f40~100<br \/>$num1=rand(0,100);<br \/>$num2=rand(0,100);<br \/>\/\/\u6700\u7ec8\u7f51\u9875\u4e2d\u7684\u5177\u4f53\u5185\u5bb9<br \/>\u00a0 \u00a0 \u00a0 echo \"&lt;p&gt;&lt;label for='math' class='small'&gt;\u9a8c\u8bc1\u7801\uff1a $num1 + $num2 = ?&lt;input type='text' name='sum' class='input' value='' size='20' tabindex='4'&gt;\"<br \/>.\"&lt;input type='hidden' name='num1' value='$num1'&gt;\"<br \/>.\"&lt;input type='hidden' name='num2' value='$num2'&gt;&lt;\/label&gt;&lt;\/p&gt;\";<br \/>}<br \/>add_action('login_form','myplugin_add_login_fields');<br \/>function login_val() {<br \/>$sum=$_POST['sum'];\/\/\u7528\u6237\u63d0\u4ea4\u7684\u8ba1\u7b97\u7ed3\u679c<br \/>switch($sum){<br \/>\/\/\u5f97\u5230\u6b63\u786e\u7684\u8ba1\u7b97\u7ed3\u679c\u5219\u76f4\u63a5\u8df3\u51fa<br \/>case $_POST['num1']+$_POST['num2']:break;<br \/>\/\/\u672a\u586b\u5199\u7ed3\u679c\u65f6\u7684\u9519\u8bef\u8baf\u606f<br \/>case null:wp_die('\u63d0\u793a: \u8bf7\u8f93\u5165\u9a8c\u8bc1\u7801.');break;<br \/>\/\/\u8ba1\u7b97\u9519\u8bef\u65f6\u7684\u9519\u8bef\u8baf\u606f<br \/>default:wp_die('\u63d0\u793a: \u9a8c\u8bc1\u7801\u9519\u8bef,\u8bf7\u91cd\u8bd5.');<br \/>}<br \/>}<br \/>add_action('login_form_login','login_val');<br \/>\/\/\u540e\u53f0\u767b\u9646\u6570\u5b66\u9a8c\u8bc1\u7801\u7ed3\u675f<\/p>\r\n\r\n<p class=\"wp-block-paragraph\">functions.php\u6587\u4ef6\u4f4d\u7f6e\uff1aWordpress\u540e\u53f0\u2014&gt;\u5916\u89c2\u2014&gt;\u4e3b\u9898\u7f16\u8f91\u5668\u2014&gt;functions.php<\/p>\r\n<p>&nbsp;<\/p><!-- \/wp:paragraph --><!-- wp:post-content --><!-- wp:paragraph -->\r\n<p>\u524d\u9762\u5927\u5934\u5206\u4eab\u4e86<a href=\"https:\/\/byy3.com\/go\/?url=http:\/\/www.datou0.com\/2020\/05\/21\/170\/\" rel=\"nofollow\" >\u9690\u85cfWordpress\u540e\u53f0\u767b\u5f55\u5730\u5740\u7684\u6559\u7a0b<\/a>\uff0c\u4f46\u662f\u611f\u89c9\u53ea\u9690\u85cf\u540e\u53f0\u8fd8\u662f\u4e0d\u592a\u5b89\u5168\uff0c\u8fd9\u6b21\u5927\u5934\u518d\u5206\u4eab\u4e00\u4e2a\u7ed9Wordpress\u540e\u53f0\u767b\u5f55\u6dfb\u52a0\u9a8c\u8bc1\u7801\u7684\u65b9\u6cd5\uff0c\u8fdb\u4e00\u6b65\u63d0\u5347\u7f51\u7ad9\u5b89\u5168\u9632\u5fa1\u3002<\/p>\r\n<!-- \/wp:paragraph -->\r\n\r\n<!-- wp:image {\"align\":\"center\",\"id\":525} -->\r\n<div class=\"wp-block-image\">\r\n<figure class=\"aligncenter\"><img decoding=\"async\" class=\"wp-image-525\" data-original=\"http:\/\/www.datou0.com\/wp-content\/uploads\/2020\/05\/178yanzheng.jpg\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"\u4e00\u62db\u6dfb\u52a0WordPress\u540e\u53f0\u767b\u5f55\u9a8c\u8bc1\u7801\u63d2\u56fe\" alt=\"\u4e00\u62db\u6dfb\u52a0WordPress\u540e\u53f0\u767b\u5f55\u9a8c\u8bc1\u7801\u63d2\u56fe\" \/><\/figure>\r\n<\/div>\r\n<!-- \/wp:image -->\r\n\r\n<!-- wp:paragraph -->\r\n<p>&nbsp;<\/p>\r\n<p>\u5c06\u4e0a\u9762\u8fd9\u4e00\u6bb5\u4ee3\u7801\u590d\u5236\u5230Wordpress\u6a21\u677f\u51fd\u6570functions.php\u6587\u4ef6\u5e95\u90e8\u5373\u53ef\u5b9e\u73b0\u6dfb\u52a0\u540e\u53f0\u767b\u5f55\u8f93\u5165\u9a8c\u8bc1\u7801\u529f\u80fd\u3002<\/p>\r\n<p><br \/>\/\/\u540e\u53f0\u767b\u9646\u6570\u5b66\u9a8c\u8bc1\u7801\u5f00\u59cb<br \/>function myplugin_add_login_fields() {<br \/>\/\/\u83b7\u53d6\u4e24\u4e2a\u968f\u673a\u6570, \u8303\u56f40~100<br \/>$num1=rand(0,100);<br \/>$num2=rand(0,100);<br \/>\/\/\u6700\u7ec8\u7f51\u9875\u4e2d\u7684\u5177\u4f53\u5185\u5bb9<br \/>\u00a0 \u00a0 \u00a0 echo \"&lt;p&gt;&lt;label for='math' class='small'&gt;\u9a8c\u8bc1\u7801\uff1a $num1 + $num2 = ?&lt;input type='text' name='sum' class='input' value='' size='20' tabindex='4'&gt;\"<br \/>.\"&lt;input type='hidden' name='num1' value='$num1'&gt;\"<br \/>.\"&lt;input type='hidden' name='num2' value='$num2'&gt;&lt;\/label&gt;&lt;\/p&gt;\";<br \/>}<br \/>add_action('login_form','myplugin_add_login_fields');<br \/>function login_val() {<br \/>$sum=$_POST['sum'];\/\/\u7528\u6237\u63d0\u4ea4\u7684\u8ba1\u7b97\u7ed3\u679c<br \/>switch($sum){<br \/>\/\/\u5f97\u5230\u6b63\u786e\u7684\u8ba1\u7b97\u7ed3\u679c\u5219\u76f4\u63a5\u8df3\u51fa<br \/>case $_POST['num1']+$_POST['num2']:break;<br \/>\/\/\u672a\u586b\u5199\u7ed3\u679c\u65f6\u7684\u9519\u8bef\u8baf\u606f<br \/>case null:wp_die('\u63d0\u793a: \u8bf7\u8f93\u5165\u9a8c\u8bc1\u7801.');break;<br \/>\/\/\u8ba1\u7b97\u9519\u8bef\u65f6\u7684\u9519\u8bef\u8baf\u606f<br \/>default:wp_die('\u63d0\u793a: \u9a8c\u8bc1\u7801\u9519\u8bef,\u8bf7\u91cd\u8bd5.');<br \/>}<br \/>}<br \/>add_action('login_form_login','login_val');<br \/>\/\/\u540e\u53f0\u767b\u9646\u6570\u5b66\u9a8c\u8bc1\u7801\u7ed3\u675f<\/p>\r\n<!-- wp:paragraph -->\r\n<p>functions.php\u6587\u4ef6\u4f4d\u7f6e\uff1aWordpress\u540e\u53f0\u2014&gt;\u5916\u89c2\u2014&gt;\u4e3b\u9898\u7f16\u8f91\u5668\u2014&gt;functions.php<\/p>\r\n<p>&nbsp;<\/p><!-- \/wp:post-content -->","protected":false},"excerpt":{"rendered":"<p>\u524d\u9762\u5927\u5934\u5206\u4eab\u4e86\u9690\u85cfWordpress\u540e\u53f0\u767b\u5f55\u5730\u5740\u7684\u6559\u7a0b\uff0c\u4f46\u662f\u611f\u89c9\u53ea\u9690\u85cf\u540e\u53f0\u8fd8\u662f\u4e0d\u592a\u5b89\u5168\uff0c\u8fd9\u6b21\u5927\u5934\u518d\u5206\u4eab\u4e00\u4e2a\u7ed9W [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-146","post","type-post","status-publish","format-standard","hentry","category-wordpress"],"_links":{"self":[{"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/posts\/146","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=146"}],"version-history":[{"count":0,"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/posts\/146\/revisions"}],"wp:attachment":[{"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=146"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=146"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}