{"id":32768,"date":"2024-11-25T13:14:35","date_gmt":"2024-11-25T05:14:35","guid":{"rendered":"https:\/\/fwq.ai\/blog\/32768\/"},"modified":"2024-11-25T13:14:35","modified_gmt":"2024-11-25T05:14:35","slug":"%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8wordpress%e6%8f%92%e4%bb%b6%e5%ae%9e%e7%8e%b0%e5%8d%b3%e6%97%b6%e6%8b%8d%e7%85%a7%e5%8a%9f%e8%83%bd","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/32768\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528WordPress\u63d2\u4ef6\u5b9e\u73b0\u5373\u65f6\u62cd\u7167\u529f\u80fd"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/164\/169388284814913.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u4f7f\u7528WordPress\u63d2\u4ef6\u5b9e\u73b0\u5373\u65f6\u62cd\u7167\u529f\u80fd\u63d2\u56fe\" alt=\"\u5982\u4f55\u4f7f\u7528WordPress\u63d2\u4ef6\u5b9e\u73b0\u5373\u65f6\u62cd\u7167\u529f\u80fd\u63d2\u56fe\" \/><\/p>\n<p>\u5982\u4f55\u4f7f\u7528WordPress\u63d2\u4ef6\u5b9e\u73b0\u5373\u65f6\u62cd\u7167\u529f\u80fd<\/p>\n<p>WordPress\u662f\u4e00\u6b3e\u77e5\u540d\u7684\u5f00\u6e90\u5185\u5bb9\u7ba1\u7406\u7cfb\u7edf\uff0c\u5e7f\u6cdb\u5e94\u7528\u4e8e\u4e2a\u4eba\u535a\u5ba2\u3001\u4f01\u4e1a\u7f51\u7ad9\u548c\u7535\u5b50\u5546\u52a1\u7f51\u7ad9\u7b49\u3002\u5176\u4e2d\u7684\u63d2\u4ef6\u7cfb\u7edf\u4e3a\u7528\u6237\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u529f\u80fd\u6269\u5c55\u3002\u5982\u679c\u4f60\u60f3\u7ed9\u4f60\u7684WordPress\u7f51\u7ad9\u6dfb\u52a0\u4e00\u4e2a\u5373\u65f6\u62cd\u7167\u529f\u80fd\uff0c\u53ef\u4ee5\u4f7f\u7528WordPress\u63d2\u4ef6\u6765\u5b9e\u73b0\u3002\u672c\u6587\u5c06\u7ed9\u51fa\u4e00\u4e2a\u4f7f\u7528\u63d2\u4ef6\u5b9e\u73b0\u5373\u65f6\u62cd\u7167\u529f\u80fd\u7684\u793a\u4f8b\u3002<\/p>\n<p>\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5\u5e76\u6fc0\u6d3b\u4e00\u4e2a\u540d\u4e3a&#8221;WP Webcam&#8221;\u7684WordPress\u63d2\u4ef6\u3002\u8be5\u63d2\u4ef6\u53ef\u4ee5\u5229\u7528\u7528\u6237\u8bbe\u5907\u7684\u6444\u50cf\u5934\u5b9e\u73b0\u5373\u65f6\u62cd\u7167\u529f\u80fd\u3002\u4f60\u53ef\u4ee5\u4eceWordPress\u5b98\u65b9\u63d2\u4ef6\u76ee\u5f55\u6216\u8005\u901a\u8fc7\u63d2\u4ef6\u7ba1\u7406\u754c\u9762\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u4f60\u9700\u8981\u5728\u4f60\u7684\u4e3b\u9898\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u7528\u4e8e\u663e\u793a\u6444\u50cf\u5934\u89c6\u9891\u6d41\u7684\u5143\u7d20\u3002\u4f60\u53ef\u4ee5\u5728\u4e3b\u9898\u7684\u67d0\u4e2a\u9875\u9762\u6216\u8005\u6587\u7ae0\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\u793a\u4f8b\uff1a<\/p>\n<pre>&lt;div id=\"cameraContainer\"&gt;&lt;\/div&gt;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u7136\u540e\uff0c\u5728\u4f60\u7684\u4e3b\u9898\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u7528\u4e8e\u89e6\u53d1\u62cd\u7167\u7684\u6309\u94ae\u3002\u4f60\u53ef\u4ee5\u5728\u4e3b\u9898\u7684\u5934\u90e8\u6216\u8005\u9875\u811a\u8fdb\u884c\u6dfb\u52a0\uff0c\u4ee5\u4e0b\u662f\u4e00\u4e2a\u4ee3\u7801\u793a\u4f8b\uff1a<\/p>\n<pre>&lt;button id=\"takePhotoButton\"&gt;\u62cd\u7167&lt;\/button&gt;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u4f60\u9700\u8981\u5728\u4f60\u7684\u4e3b\u9898\u4e2d\u5f15\u7528WP Webcam\u63d2\u4ef6\u7684\u76f8\u5173\u4ee3\u7801\u3002\u4f60\u53ef\u4ee5\u5728\u4e3b\u9898\u7684functions.php\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<pre>function wpwebcam_enqueue_scripts() {\n    wp_enqueue_script( 'wpwebcam', plugin_dir_url( __FILE__ ) . 'js\/wp-webcam.js', array( 'jquery' ), '1.0', true );\n}\n\nadd_action( 'wp_enqueue_scripts', 'wpwebcam_enqueue_scripts' );<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u7136\u540e\uff0c\u4f60\u9700\u8981\u5728\u4f60\u7684\u4e3b\u9898\u4e2d\u7f16\u5199\u4e00\u4e2aJavaScript\u6587\u4ef6\uff0c\u7528\u4e8e\u521d\u59cb\u5316WP Webcam\u63d2\u4ef6\u5e76\u4e3a\u62cd\u7167\u6309\u94ae\u6dfb\u52a0\u4e8b\u4ef6\u76d1\u542c\u3002\u521b\u5efa\u4e00\u4e2a\u540d\u4e3awp-webcam.js\u7684\u6587\u4ef6\uff0c\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<pre>jQuery(document).ready(function($) {\n    var videoElement = document.getElementById('cameraContainer'),\n        takePhotoButton = document.getElementById('takePhotoButton');\n\n    \/\/ \u521d\u59cb\u5316WP Webcam\u63d2\u4ef6\n    var webcam = new Webcam(videoElement);\n\n    \/\/ \u76d1\u542c\u62cd\u7167\u6309\u94ae\u7684\u70b9\u51fb\u4e8b\u4ef6\n    takePhotoButton.addEventListener('click', function() {\n        webcam.snap(function(dataUri) {\n            \/\/ \u5728\u8fd9\u4e2a\u56de\u8c03\u51fd\u6570\u4e2d\uff0c\u4f60\u53ef\u4ee5\u5904\u7406\u62cd\u7167\u540e\u7684\u6570\u636e\n            console.log(dataUri);\n        });\n    });\n});<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u6700\u540e\uff0c\u4f60\u9700\u8981\u5728\u4f60\u7684\u4e3b\u9898\u4e2d\u6dfb\u52a0\u6837\u5f0f\u6765\u7f8e\u5316\u6444\u50cf\u5934\u89c6\u9891\u6d41\u548c\u62cd\u7167\u6309\u94ae\u3002\u4f60\u53ef\u4ee5\u5728\u4e3b\u9898\u7684CSS\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\u793a\u4f8b\uff1a<\/p>\n<pre>#cameraContainer {\n    width: 640px;\n    height: 480px;\n    border: 2px solid #000;\n}\n\n#takePhotoButton {\n    margin-top: 10px;\n    padding: 5px 10px;\n    background-color: #007bff;\n    color: #fff;\n    border: none;\n    border-radius: 3px;\n    cursor: pointer;\n}<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5b8c\u6210\u4ee5\u4e0a\u6b65\u9aa4\u540e\uff0c\u4f60\u53ef\u4ee5\u5237\u65b0\u4f60\u7684WordPress\u7f51\u7ad9\uff0c\u5e76\u5728\u6307\u5b9a\u9875\u9762\u6216\u6587\u7ae0\u4e2d\u770b\u5230\u6444\u50cf\u5934\u89c6\u9891\u6d41\u548c\u62cd\u7167\u6309\u94ae\u7684\u5c55\u793a\u3002\u70b9\u51fb\u62cd\u7167\u6309\u94ae\u540e\uff0c\u4f60\u53ef\u4ee5\u5728\u6d4f\u89c8\u5668\u7684\u63a7\u5236\u53f0\u4e2d\u770b\u5230\u62cd\u7167\u540e\u7684\u6570\u636eURI\u3002<\/p>\n<p>\u5f53\u7136\uff0c\u4ee5\u4e0a\u53ea\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\uff0c\u4f60\u53ef\u4ee5\u6839\u636e\u4f60\u7684\u9700\u6c42\u8fdb\u884c\u5b9a\u5236\u548c\u6269\u5c55\u3002WP Webcam\u63d2\u4ef6\u7684\u6587\u6863\u4e2d\u6709\u66f4\u591a\u7684\u529f\u80fd\u548c\u9009\u9879\u53ef\u4f9b\u53c2\u8003\u3002\u5e0c\u671b\u672c\u6587\u5bf9\u4f60\u7406\u89e3\u5982\u4f55\u4f7f\u7528WordPress\u63d2\u4ef6\u5b9e\u73b0\u5373\u65f6\u62cd\u7167\u529f\u80fd\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u4f7f\u7528WordPress\u63d2\u4ef6\u5b9e\u73b0\u5373\u65f6\u62cd\u7167\u529f\u80fd\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>\u5982\u4f55\u4f7f\u7528WordPress\u63d2\u4ef6\u5b9e\u73b0\u5373\u65f6\u62cd\u7167\u529f\u80fd WordPress\u662f\u4e00\u6b3e\u77e5\u540d\u7684\u5f00\u6e90\u5185\u5bb9\u7ba1\u7406\u7cfb\u7edf\uff0c\u5e7f\u6cdb\u5e94\u7528\u4e8e\u4e2a\u4eba\u535a\u5ba2\u3001\u4f01\u4e1a\u7f51\u7ad9\u548c\u7535\u5b50\u5546\u52a1\u7f51\u7ad9\u7b49\u3002\u5176\u4e2d\u7684\u63d2\u4ef6\u7cfb\u7edf\u4e3a\u7528\u6237\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u529f\u80fd\u6269\u5c55\u3002\u5982\u679c\u4f60\u60f3\u7ed9\u4f60\u7684WordPress\u7f51\u7ad9\u6dfb\u52a0\u4e00\u4e2a\u5373\u65f6\u62cd\u7167\u529f\u80fd\uff0c\u53ef\u4ee5\u4f7f\u7528WordPress\u63d2\u4ef6\u6765\u5b9e\u73b0\u3002\u672c\u6587\u5c06\u7ed9\u51fa\u4e00\u4e2a\u4f7f\u7528\u63d2\u4ef6\u5b9e\u73b0\u5373\u65f6\u62cd\u7167\u529f\u80fd\u7684\u793a\u4f8b\u3002 \u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5\u5e76\u6fc0\u6d3b\u4e00\u4e2a\u540d\u4e3a&#8221;WP Webcam&#8221;\u7684WordPress\u63d2\u4ef6\u3002\u8be5\u63d2\u4ef6\u53ef\u4ee5\u5229\u7528\u7528\u6237\u8bbe\u5907\u7684\u6444\u50cf\u5934\u5b9e\u73b0\u5373\u65f6\u62cd\u7167\u529f\u80fd\u3002\u4f60\u53ef\u4ee5\u4eceWordPress\u5b98\u65b9\u63d2\u4ef6\u76ee\u5f55\u6216\u8005\u901a\u8fc7\u63d2\u4ef6\u7ba1\u7406\u754c\u9762\u8fdb\u884c\u5b89\u88c5\u3002 \u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u4f60\u9700\u8981\u5728\u4f60\u7684\u4e3b\u9898\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u7528\u4e8e\u663e\u793a\u6444\u50cf\u5934\u89c6\u9891\u6d41\u7684\u5143\u7d20\u3002\u4f60\u53ef\u4ee5\u5728\u4e3b\u9898\u7684\u67d0\u4e2a\u9875\u9762\u6216\u8005\u6587\u7ae0\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\u793a\u4f8b\uff1a &lt;div id=&#8221;cameraContainer&#8221;&gt;&lt;\/div&gt; \u767b\u5f55\u540e\u590d\u5236 \u7136\u540e\uff0c\u5728\u4f60\u7684\u4e3b\u9898\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u7528\u4e8e\u89e6\u53d1\u62cd\u7167\u7684\u6309\u94ae\u3002\u4f60\u53ef\u4ee5\u5728\u4e3b\u9898\u7684\u5934\u90e8\u6216\u8005\u9875\u811a\u8fdb\u884c\u6dfb\u52a0\uff0c\u4ee5\u4e0b\u662f\u4e00\u4e2a\u4ee3\u7801\u793a\u4f8b\uff1a &lt;button id=&#8221;takePhotoButton&#8221;&gt;\u62cd\u7167&lt;\/button&gt; \u767b\u5f55\u540e\u590d\u5236 \u63a5\u4e0b\u6765\uff0c\u4f60\u9700\u8981\u5728\u4f60\u7684\u4e3b\u9898\u4e2d\u5f15\u7528WP Webcam\u63d2\u4ef6\u7684\u76f8\u5173\u4ee3\u7801\u3002\u4f60\u53ef\u4ee5\u5728\u4e3b\u9898\u7684functions.php\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff1a function wpwebcam_enqueue_scripts() { wp_enqueue_script( &#8216;wpwebcam&#8217;, plugin_dir_url( __FILE__ ) . &#8216;js\/wp-webcam.js&#8217;, array( &#8216;jquery&#8217; ), &#8216;1.0&#8217;, true ); } add_action( &#8216;wp_enqueue_scripts&#8217;, &#8216;wpwebcam_enqueue_scripts&#8217; ); \u767b\u5f55\u540e\u590d\u5236 \u7136\u540e\uff0c\u4f60\u9700\u8981\u5728\u4f60\u7684\u4e3b\u9898\u4e2d\u7f16\u5199\u4e00\u4e2aJavaScript\u6587\u4ef6\uff0c\u7528\u4e8e\u521d\u59cb\u5316WP Webcam\u63d2\u4ef6\u5e76\u4e3a\u62cd\u7167\u6309\u94ae\u6dfb\u52a0\u4e8b\u4ef6\u76d1\u542c\u3002\u521b\u5efa\u4e00\u4e2a\u540d\u4e3awp-webcam.js\u7684\u6587\u4ef6\uff0c\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff1a jQuery(document).ready(function($) { var videoElement = document.getElementById(&#8216;cameraContainer&#8217;), takePhotoButton = document.getElementById(&#8216;takePhotoButton&#8217;); \/\/ \u521d\u59cb\u5316WP Webcam\u63d2\u4ef6 var webcam = new Webcam(videoElement); [&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-32768","post","type-post","status-publish","format-standard","hentry","category-cms"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/32768","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=32768"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/32768\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=32768"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=32768"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=32768"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}