{"id":4026,"date":"2025-06-24T12:00:01","date_gmt":"2025-06-24T04:00:01","guid":{"rendered":"https:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/"},"modified":"2025-06-24T12:00:01","modified_gmt":"2025-06-24T04:00:01","slug":"javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript","status":"publish","type":"post","link":"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/","title":{"rendered":"javascript\u63d2\u4ef6_\u4ee5\u6b63\u786e\u7684\u65b9\u5f0f\u5728\u63d2\u4ef6\u6216\u4e3b\u9898\u4e2d\u5305\u542bJavaScript"},"content":{"rendered":"<div class=\"article_content clearfix\" id=\"article_content\">\n <link href=\"https:\/\/csdnimg.cn\/release\/blogv2\/dist\/mdeditor\/css\/editerView\/kdoc_html_views-1a98987dfd.css\" rel=\"stylesheet\"\/>\n <link href=\"https:\/\/csdnimg.cn\/release\/blogv2\/dist\/mdeditor\/css\/editerView\/ck_htmledit_views-01addd087f.css\" rel=\"stylesheet\"\/>\n<div class=\"htmledit_views atom-one-dark\" id=\"content_views\">\n<section>\n<p>\n    javascript\u63d2\u4ef6\n   <\/p>\n<p>\n    At the time of writing, more than 33,000 plugins and 2,600 themes are available on<br \/>\n    <a href=\"http:\/\/wordpress.org\/\" rel=\"nofollow\"><br \/>\n     WordPress.org<br \/>\n    <\/a><br \/>\n    , and we can probably add more which are not present on this platform. They can do a lot of different things and, often, they use JavaScript to provide some features.\n   <\/p>\n<p>\n    \u5728\u64b0\u5199\u672c\u6587\u65f6\uff0c<br \/>\n    <a href=\"http:\/\/wordpress.org\/\" rel=\"nofollow\"><br \/>\n     WordPress.org<br \/>\n    <\/a><br \/>\n    \u4e0a\u63d0\u4f9b\u4e86\u8d85\u8fc733,000\u4e2a\u63d2\u4ef6\u548c2,600\u4e2a\u4e3b\u9898\uff0c\u6211\u4eec\u53ef\u80fd\u4f1a\u6dfb\u52a0\u66f4\u591a\u5728\u6b64\u5e73\u53f0\u4e0a\u4e0d\u5b58\u5728\u7684\u63d2\u4ef6\u3002 \u4ed6\u4eec\u53ef\u4ee5\u505a\u5f88\u591a\u4e0d\u540c\u7684\u4e8b\u60c5\uff0c\u5e76\u4e14\u7ecf\u5e38\u4f7f\u7528JavaScript\u63d0\u4f9b\u67d0\u4e9b\u529f\u80fd\u3002\n   <\/p>\n<div style=\"text-align: center;\">\n   <\/div>\n<p>\n    Basically, including JavaScript code into a theme or a plugin is not difficult: what WordPress produces is nothing else than HTML so using the<br \/>\n    <code><br \/>\n     script<br \/>\n    <\/code><br \/>\n    tag with code directly into it or into a file linked thanks to the<br \/>\n    <code><br \/>\n     src<br \/>\n    <\/code><br \/>\n    attribute might be enough \u2013 if you were alone, developing in isolation.\n   <\/p>\n<p>\n    \u57fa\u672c\u4e0a\uff0c\u5c06JavaScript\u4ee3\u7801\u5305\u542b\u5230\u4e3b\u9898\u6216\u63d2\u4ef6\u4e2d\u5e76\u4e0d\u96be\uff1aWordPress\u751f\u6210\u7684\u5185\u5bb9\u7edd\u975eHTML\u6240\u81f4\uff0c\u56e0\u6b64\uff0c\u901a\u8fc7<br \/>\n    <code><br \/>\n     src<br \/>\n    <\/code><br \/>\n    \u5c5e\u6027\u76f4\u63a5\u5c06<br \/>\n    <code><br \/>\n     script<br \/>\n    <\/code><br \/>\n    \u6807\u8bb0\u4e0e\u4ee3\u7801\u4e00\u8d77\u4f7f\u7528\u6216\u94fe\u63a5\u5230\u6587\u4ef6\u4e2d\uff0c\u4f7f\u7528<br \/>\n    <code><br \/>\n     src<br \/>\n    <\/code><br \/>\n    \u53ef\u80fd\u5c31\u8db3\u591f\u4e86\u3002\u4e00\u4e2a\u4eba\uff0c\u5b64\u7acb\u5730\u53d1\u5c55\u3002\n   <\/p>\n<p>\n    The fact is<br \/>\n    <strong><br \/>\n     you are not alone<br \/>\n    <\/strong><br \/>\n    . People using WordPress can install plugins or themes next to yours, and the developers of these tools can also use JavaScript. Moreover, WordPress itself is using JavaScript. The problem is, if everyone includes their scripts without attention, the resulting page will be unnecessarily heavy.\n   <\/p>\n<p>\n    \u4e8b\u5b9e\u662f<br \/>\n    <strong><br \/>\n     \u4f60\u5e76\u4e0d\u5b64\u5355<br \/>\n    <\/strong><br \/>\n    \u3002 \u4f7f\u7528WordPress\u7684\u4eba\u53ef\u4ee5\u5728\u60a8\u7684\u65c1\u8fb9\u5b89\u88c5\u63d2\u4ef6\u6216\u4e3b\u9898\uff0c\u8fd9\u4e9b\u5de5\u5177\u7684\u5f00\u53d1\u4eba\u5458\u4e5f\u53ef\u4ee5\u4f7f\u7528JavaScript\u3002 \u800c\u4e14\uff0cWordPress\u672c\u8eab\u6b63\u5728\u4f7f\u7528JavaScript\u3002 \u95ee\u9898\u662f\uff0c\u5982\u679c\u6bcf\u4e2a\u4eba\u90fd\u5305\u62ec\u4ed6\u4eec\u7684\u811a\u672c\u800c\u6ca1\u6709\u5f15\u8d77\u6ce8\u610f\uff0c\u5219\u7ed3\u679c\u9875\u9762\u5c06\u4e0d\u5fc5\u8981\u5730\u7e41\u91cd\u3002\n   <\/p>\n<h3>\n    \u95ee\u9898<br \/>\n    <span style=\"font-weight: bold;\"><br \/>\n     (<br \/>\n    <\/span><br \/>\n    The Problem<br \/>\n    <span style=\"font-weight: bold;\"><br \/>\n     )<br \/>\n    <\/span><br \/>\n   <\/h3>\n<p>\n    An example will be clearer, and I will take one that I know well: mine.\n   <\/p>\n<p>\n    \u4e00\u4e2a\u4f8b\u5b50\u5c06\u66f4\u52a0\u6e05\u695a\uff0c\u6211\u5c06\u4e3e\u4e00\u4e2a\u6211\u719f\u77e5\u7684\u4f8b\u5b50\uff1a\u6211\u7684\u3002\n   <\/p>\n<p>\n    I developed the<br \/>\n    <a href=\"http:\/\/wordpress.org\/plugins\/wp-photo-sphere\/\" rel=\"nofollow\"><br \/>\n     WP Photo Sphere<br \/>\n    <\/a><br \/>\n    plugin which allows users to add panoramas into their posts. To do that, I needed different JavaScript files: the library used to display this panoramas and the file that retrieves specific tags where panoramas are displayed. Moreover, in this last script, I use jQuery, so I need to include it.\n   <\/p>\n<p>\n    \u6211\u5f00\u53d1\u4e86<br \/>\n    <a href=\"http:\/\/wordpress.org\/plugins\/wp-photo-sphere\/\" rel=\"nofollow\"><br \/>\n     WP Photo Sphere<br \/>\n    <\/a><br \/>\n    \u63d2\u4ef6\uff0c\u8be5\u63d2\u4ef6\u5141\u8bb8\u7528\u6237\u5c06\u5168\u666f\u7167\u7247\u6dfb\u52a0\u5230\u4ed6\u4eec\u7684\u5e16\u5b50\u4e2d\u3002 \u4e3a\u6b64\uff0c\u6211\u9700\u8981\u4e0d\u540cJavaScript\u6587\u4ef6\uff1a\u7528\u4e8e\u663e\u793a\u6b64\u5168\u666f\u56fe\u7684\u5e93\u548c\u7528\u4e8e\u68c0\u7d22\u663e\u793a\u5168\u666f\u56fe\u7684\u7279\u5b9a\u6807\u7b7e\u7684\u6587\u4ef6\u3002 \u6b64\u5916\uff0c\u5728\u6700\u540e\u4e00\u4e2a\u811a\u672c\u4e2d\uff0c\u6211\u4f7f\u7528jQuery\uff0c\u56e0\u6b64\u9700\u8981\u5305\u542b\u5b83\u3002\n   <\/p>\n<p>\n    If I did not care about users, I could insert these three scripts into all the pages of the websites which means visitors will have to download these files, even if the page does not need it.\n   <\/p>\n<p>\n    \u5982\u679c\u6211\u4e0d\u5173\u5fc3\u7528\u6237\uff0c\u5219\u53ef\u4ee5\u5c06\u8fd9\u4e09\u4e2a\u811a\u672c\u63d2\u5165\u7f51\u7ad9\u7684\u6240\u6709\u9875\u9762\uff0c\u8fd9\u610f\u5473\u7740\u5373\u4f7f\u9875\u9762\u4e0d\u9700\u8981\u5b83\uff0c\u8bbf\u95ee\u8005\u4e5f\u5fc5\u987b\u4e0b\u8f7d\u8fd9\u4e9b\u6587\u4ef6\u3002\n   <\/p>\n<p>\n    At this time, the problem is already significant, but it becomes even bigger when we think about jQuery. What if two plugins using this library have this behavior? Not only will users download a useless file, but they will also download it twice!\n   <\/p>\n<p>\n    \u76ee\u524d\uff0c\u8fd9\u4e2a\u95ee\u9898\u5df2\u7ecf\u5f88\u4e25\u91cd\u4e86\uff0c\u4f46\u662f\u5f53\u6211\u4eec\u60f3\u5230jQuery\u65f6\uff0c\u8fd9\u4e2a\u95ee\u9898\u751a\u81f3\u53d8\u5f97\u66f4\u5927\u3002 \u5982\u679c\u4f7f\u7528\u6b64\u5e93\u7684\u4e24\u4e2a\u63d2\u4ef6\u90fd\u6709\u6b64\u884c\u4e3a\u600e\u4e48\u529e\uff1f \u7528\u6237\u4e0d\u4ec5\u4f1a\u4e0b\u8f7d\u65e0\u7528\u7684\u6587\u4ef6\uff0c\u800c\u4e14\u8fd8\u4f1a\u4e0b\u8f7d\u4e24\u6b21\uff01\n   <\/p>\n<p>\n    The heavier a page is, the longer it will take to load. Websites that are too long to load are visited less than faster websites. If your plugin or theme makes the time of loading too long, they won\u2019t be used. That is surely is a great motivation to optimize your tools, right?\n   <\/p>\n<p>\n    \u9875\u9762\u8d8a\u91cd\uff0c\u52a0\u8f7d\u65f6\u95f4\u8d8a\u957f\u3002 \u8bbf\u95ee\u65f6\u95f4\u592a\u957f\u800c\u65e0\u6cd5\u52a0\u8f7d\u7684\u7f51\u7ad9\u6bd4\u8bbf\u95ee\u901f\u5ea6\u66f4\u5feb\u7684\u7f51\u7ad9\u8981\u5c11\u3002 \u5982\u679c\u60a8\u7684\u63d2\u4ef6\u6216\u4e3b\u9898\u4f7f\u52a0\u8f7d\u65f6\u95f4\u8fc7\u957f\uff0c\u5219\u5c06\u4e0d\u4f1a\u4f7f\u7528\u5b83\u4eec\u3002 \u5f53\u7136\uff0c\u8fd9\u662f\u4f18\u5316\u5de5\u5177\u7684\u5de8\u5927\u52a8\u529b\uff0c\u5bf9\u5417\uff1f\n   <\/p>\n<h3>\n    \u63d2\u5165\u811a\u672c\u7684\u5fc5\u7136\u529f\u80fd<br \/>\n    <span style=\"font-weight: bold;\"><br \/>\n     (<br \/>\n    <\/span><br \/>\n    The Inevitable Function to Insert Scripts<br \/>\n    <span style=\"font-weight: bold;\"><br \/>\n     )<br \/>\n    <\/span><br \/>\n   <\/h3>\n<p>\n    To avoid the problem of inserting the same file twice or more, WordPress provides us a great function:<br \/>\n    <code><br \/>\n     wp_enqueue_script()<br \/>\n    <\/code><br \/>\n    .<br \/>\n    <strong><br \/>\n     When you want to insert a script, this function must become your best friend.<br \/>\n    <\/strong>\n   <\/p>\n<p>\n    \u4e3a\u4e86\u907f\u514d\u4e24\u6b21\u6216\u591a\u6b21\u63d2\u5165\u540c\u4e00\u6587\u4ef6\u7684\u95ee\u9898\uff0cWordPress\u4e3a\u6211\u4eec\u63d0\u4f9b\u4e86\u4e00\u4e2a\u5f88\u68d2\u7684\u529f\u80fd\uff1a<br \/>\n    <code><br \/>\n     wp_enqueue_script()<br \/>\n    <\/code><br \/>\n    \u3002<br \/>\n    <strong><br \/>\n     \u5f53\u60a8\u8981\u63d2\u5165\u811a\u672c\u65f6\uff0c\u6b64\u529f\u80fd\u5fc5\u987b\u6210\u4e3a\u60a8\u6700\u597d\u7684\u670b\u53cb\u3002<br \/>\n    <\/strong>\n   <\/p>\n<p>\n    As its name suggests it, this function will add your scripts to a queue and include them at the right moment, into the header or into the footer, so no<br \/>\n    <code><br \/>\n     script<br \/>\n    <\/code><br \/>\n    tag will be added at the middle of the page.\n   <\/p>\n<p>\n    \u987e\u540d\u601d\u4e49\uff0c\u6b64\u51fd\u6570\u4f1a\u5c06\u811a\u672c\u6dfb\u52a0\u5230\u961f\u5217\u4e2d\uff0c\u5e76\u5728\u9002\u5f53\u7684\u65f6\u5019\u5c06\u5176\u5305\u62ec\u5728\u9875\u7709\u6216\u9875\u811a\u4e2d\uff0c\u56e0\u6b64\u4e0d\u4f1a\u5728\u9875\u9762\u4e2d\u95f4\u6dfb\u52a0\u4efb\u4f55<br \/>\n    <code><br \/>\n     script<br \/>\n    <\/code><br \/>\n    \u6807\u7b7e\u3002\n   <\/p>\n<p>\n    Used alone, the<br \/>\n    <code><br \/>\n     wp_enqueue_script()<br \/>\n    <\/code><br \/>\n    function requires at least two parameters: the name of the script and the URL to it. For example, if I want to include a script needed by my plugin, I add this line into its main file (we will see proper ways to do that below).\n   <\/p>\n<p>\n    <code><br \/>\n     wp_enqueue_script()<br \/>\n    <\/code><br \/>\n    \u51fd\u6570\u5355\u72ec\u4f7f\u7528\u65f6\uff0c\u81f3\u5c11\u9700\u8981\u4e24\u4e2a\u53c2\u6570\uff1a\u811a\u672c\u7684\u540d\u79f0\u548cURL\u3002 \u4f8b\u5982\uff0c\u5982\u679c\u8981\u5305\u542b\u63d2\u4ef6\u6240\u9700\u7684\u811a\u672c\uff0c\u8bf7\u5c06\u6b64\u884c\u6dfb\u52a0\u5230\u5176\u4e3b\u6587\u4ef6\u4e2d(\u6211\u4eec\u5c06\u5728\u4e0b\u9762\u770b\u5230\u6267\u884c\u6b64\u64cd\u4f5c\u7684\u6b63\u786e\u65b9\u6cd5)\u3002\n   <\/p>\n<pre class=\"has\" tabindex=\"0\"><code class=\"language-php\">wp_enqueue_script('test', plugin_dir_url(__FILE__) . 'test.js');<\/code><\/pre>\n<p>\n    However, three additional parameters let you have more control on the way your script will be included, especially the last parameter which is a boolean: by default, this boolean is set to<br \/>\n    <code><br \/>\n     false<br \/>\n    <\/code><br \/>\n    and your script will be included in the<br \/>\n    <code><br \/>\n     head<br \/>\n    <\/code><br \/>\n    tag, but if you set it to<br \/>\n    <code><br \/>\n     true<br \/>\n    <\/code><br \/>\n    , then your script will be included in the footer.\n   <\/p>\n<p>\n    \u4f46\u662f\uff0c\u901a\u8fc7\u4e09\u4e2a\u9644\u52a0\u53c2\u6570\uff0c\u60a8\u53ef\u4ee5\u66f4\u597d\u5730\u63a7\u5236\u811a\u672c\u7684\u6dfb\u52a0\u65b9\u5f0f\uff0c\u5c24\u5176\u662f\u6700\u540e\u4e00\u4e2a\u53c2\u6570\u662f\u5e03\u5c14\u503c\uff1a\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u6b64\u5e03\u5c14\u503c\u8bbe\u7f6e\u4e3a<br \/>\n    <code><br \/>\n     false<br \/>\n    <\/code><br \/>\n    \uff0c\u811a\u672c\u5c06\u5305\u542b\u5728<br \/>\n    <code><br \/>\n     head<br \/>\n    <\/code><br \/>\n    \u6807\u8bb0\u4e2d\uff0c\u4f46\u662f\u5982\u679c\u60a8\u5c06\u5176\u8bbe\u7f6e\u4e3a<br \/>\n    <code><br \/>\n     true<br \/>\n    <\/code><br \/>\n    \uff0c\u90a3\u4e48\u60a8\u7684\u811a\u672c\u5c06\u5305\u542b\u5728\u9875\u811a\u4e2d\u3002\n   <\/p>\n<p>\n    The fourth parameter is useful if you make various versions of your script: it is a string containing the version number which will be concatenated to the end of the URL. Adding a version number ensures that visitors will get the right version of your script, regardless of caching.\n   <\/p>\n<p>\n    \u5982\u679c\u60a8\u5236\u4f5c\u4e86\u4e0d\u540c\u7248\u672c\u7684\u811a\u672c\uff0c\u5219\u7b2c\u56db\u4e2a\u53c2\u6570\u5f88\u6709\u7528\uff1a\u5b83\u662f\u4e00\u4e2a\u5305\u542b\u7248\u672c\u53f7\u7684\u5b57\u7b26\u4e32\uff0c\u8be5\u5b57\u7b26\u4e32\u5c06\u8fde\u63a5\u5230URL\u7684\u672b\u5c3e\u3002 \u6dfb\u52a0\u7248\u672c\u53f7\u53ef\u786e\u4fdd\u8bbf\u95ee\u8005\u65e0\u8bba\u7f13\u5b58\u5982\u4f55\u90fd\u53ef\u83b7\u5f97\u6b63\u786e\u7684\u811a\u672c\u7248\u672c\u3002\n   <\/p>\n<p>\n    The third parameter is one of the most interesting because it lets you indicate dependencies for your script. For example, if your script needs the library jQuery, you can use this parameter.\n   <\/p>\n<p>\n    \u7b2c\u4e09\u4e2a\u53c2\u6570\u662f\u6700\u6709\u8da3\u7684\u53c2\u6570\u4e4b\u4e00\uff0c\u56e0\u4e3a\u5b83\u4f7f\u60a8\u53ef\u4ee5\u6307\u793a\u811a\u672c\u7684\u4f9d\u8d56\u6027\u3002 \u4f8b\u5982\uff0c\u5982\u679c\u60a8\u7684\u811a\u672c\u9700\u8981jQuery\u5e93\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528\u6b64\u53c2\u6570\u3002\n   <\/p>\n<pre class=\"has\" tabindex=\"0\"><code class=\"language-php\">wp_enqueue_script('test', plugin_dir_url(__FILE__) . 'test.js', array('jquery'));<\/code><\/pre>\n<p>\n    As you can see, dependencies must be indicated into an array, even if there is only one dependency. The name you indicate into this array is the name of a script registered thanks to a second function:<br \/>\n    <code><br \/>\n     wp_register_script()<br \/>\n    <\/code><br \/>\n    .\n   <\/p>\n<p>\n    \u5982\u60a8\u6240\u89c1\uff0c\u5373\u4f7f\u53ea\u6709\u4e00\u4e2a\u4f9d\u8d56\u6027\uff0c\u4e5f\u5fc5\u987b\u5c06\u4f9d\u8d56\u6027\u8868\u793a\u5728\u6570\u7ec4\u4e2d\u3002 \u60a8\u5728\u6b64\u6570\u7ec4\u4e2d\u6307\u5b9a\u7684\u540d\u79f0\u662f\u901a\u8fc7\u7b2c\u4e8c\u4e2a\u529f\u80fd<br \/>\n    <code><br \/>\n     wp_register_script()<br \/>\n    <\/code><br \/>\n    \u6ce8\u518c\u7684\u811a\u672c\u540d\u79f0\u3002\n   <\/p>\n<p>\n    The use of this second function is exactly the same as the use of the first: you indicate the name of the script, its URL, its dependencies, its version number and whether it must be included into the footer or not. The last three parameters are optional but the others are required.\n   <\/p>\n<p>\n    \u7b2c\u4e8c\u4e2a\u529f\u80fd\u7684\u4f7f\u7528\u4e0e\u7b2c\u4e00\u4e2a\u529f\u80fd\u7684\u4f7f\u7528\u5b8c\u5168\u76f8\u540c\uff1a\u60a8\u6307\u5b9a\u811a\u672c\u7684\u540d\u79f0\uff0c\u5176URL\uff0c\u5176\u4f9d\u8d56\u9879\uff0c\u5176\u7248\u672c\u53f7\u4ee5\u53ca\u662f\u5426\u5fc5\u987b\u5c06\u5176\u5305\u542b\u5728\u9875\u811a\u4e2d\u3002 \u6700\u540e\u4e09\u4e2a\u53c2\u6570\u662f\u53ef\u9009\u7684\uff0c\u4f46\u5176\u4ed6\u53c2\u6570\u662f\u5fc5\u9700\u7684\u3002\n   <\/p>\n<pre class=\"has\" tabindex=\"0\"><code class=\"language-php\">wp_register_script('test', plugin_dir_url(__FILE__) . 'test.js', array('jquery'), '1.0', true);<\/code><\/pre>\n<p>\n    Register a script will not include it. You still have to use the<br \/>\n    <code><br \/>\n     wp_enqueue_script()<br \/>\n    <\/code><br \/>\n    function to include your scripts, but its use is then simplified: you only have to indicate the name of the script.\n   <\/p>\n<p>\n    \u6ce8\u518c\u811a\u672c\u5c06\u4e0d\u5305\u542b\u5b83\u3002 \u60a8\u4ecd\u7136\u5fc5\u987b\u4f7f\u7528<br \/>\n    <code><br \/>\n     wp_enqueue_script()<br \/>\n    <\/code><br \/>\n    \u51fd\u6570\u6765\u5305\u542b\u811a\u672c\uff0c\u4f46\u662f\u968f\u540e\u5b83\u7684\u4f7f\u7528\u5f97\u4ee5\u7b80\u5316\uff1a\u60a8\u53ea\u9700\u6307\u51fa\u811a\u672c\u7684\u540d\u79f0\u3002\n   <\/p>\n<pre class=\"has\" tabindex=\"0\"><code class=\"language-php\">wp_enqueue_script('test');<\/code><\/pre>\n<p>\n    Maybe you are asking yourself about the usefulness of the<br \/>\n    <code><br \/>\n     wp_register_script()<br \/>\n    <\/code><br \/>\n    as the<br \/>\n    <code><br \/>\n     wp_enqueue_script()<br \/>\n    <\/code><br \/>\n    can do all the job. This function is here to indicate the way a script should be included but does not include it if it is not necessary.\n   <\/p>\n<p>\n    \u4e5f\u8bb8\u60a8\u6b63\u5728\u95ee\u81ea\u5df1\u5173\u4e8e<br \/>\n    <code><br \/>\n     wp_register_script()<br \/>\n    <\/code><br \/>\n    \u7684\u7528\u5904\uff0c\u56e0\u4e3a<br \/>\n    <code><br \/>\n     wp_enqueue_script()<br \/>\n    <\/code><br \/>\n    \u53ef\u4ee5\u5b8c\u6210\u6240\u6709\u5de5\u4f5c\u3002 \u6b64\u529f\u80fd\u5728\u6b64\u5904\u6307\u793a\u5e94\u5305\u542b\u811a\u672c\u7684\u65b9\u5f0f\uff0c\u4f46\u5728\u4e0d\u9700\u8981\u65f6\u4e0d\u5305\u542b\u811a\u672c\u3002\n   <\/p>\n<p>\n    An example will be clearer, so imagine that you have two JavaScript files to include. The first file is a library, and the second file uses this library to do some things. The library needs jQuery to work properly, so we register it as follows:\n   <\/p>\n<p>\n    \u4e00\u4e2a\u793a\u4f8b\u5c06\u66f4\u52a0\u6e05\u695a\uff0c\u56e0\u6b64\uff0c\u5047\u8bbe\u60a8\u8981\u5305\u542b\u4e24\u4e2aJavaScript\u6587\u4ef6\u3002 \u7b2c\u4e00\u4e2a\u6587\u4ef6\u662f\u4e00\u4e2a\u5e93\uff0c\u7b2c\u4e8c\u4e2a\u6587\u4ef6\u4f7f\u7528\u8be5\u5e93\u6765\u505a\u4e00\u4e9b\u4e8b\u60c5\u3002 \u8be5\u5e93\u9700\u8981jQuery\u624d\u80fd\u6b63\u5e38\u5de5\u4f5c\uff0c\u56e0\u6b64\u6211\u4eec\u5c06\u5176\u6ce8\u518c\u5982\u4e0b\uff1a\n   <\/p>\n<pre class=\"has\" tabindex=\"0\"><code class=\"language-php\">wp_register_script('mylib', plugin_dir_url(__FILE__) . 'lib\/mylib.js', array('jquery'));<\/code><\/pre>\n<p>\n    At this time, the library is not included, but if we want to include the main file, then we need to include this library: we indicate it as a dependency.\n   <\/p>\n<p>\n    \u76ee\u524d\u4e0d\u5305\u62ec\u8be5\u5e93\uff0c\u4f46\u662f\u5982\u679c\u8981\u5305\u62ec\u4e3b\u6587\u4ef6\uff0c\u5219\u9700\u8981\u5305\u62ec\u8be5\u5e93\uff1a\u5c06\u5176\u8868\u793a\u4e3a\u4f9d\u8d56\u9879\u3002\n   <\/p>\n<pre class=\"has\" tabindex=\"0\"><code class=\"language-php\">wp_enqueue_script('myfile', plugin_dir_url(__FILE__) . 'myfile.js', array('mylib'));<\/code><\/pre>\n<p>\n    And all the magic appears. The<br \/>\n    <code><br \/>\n     myfile.js<br \/>\n    <\/code><br \/>\n    file is included, but it needs the<br \/>\n    <code><br \/>\n     mylib.js<br \/>\n    <\/code><br \/>\n    file to work: that\u2019s the job of the dependency which will include this file. But! The<br \/>\n    <code><br \/>\n     mylib.js<br \/>\n    <\/code><br \/>\n    file needs jQuery, so jQuery is included too. Three files included in one line.\n   <\/p>\n<p>\n    \u6240\u6709\u7684\u9b54\u529b\u51fa\u73b0\u4e86\u3002 \u5305\u542b\u4e86<br \/>\n    <code><br \/>\n     myfile.js<br \/>\n    <\/code><br \/>\n    \u6587\u4ef6\uff0c\u4f46\u662f\u5b83\u9700\u8981<br \/>\n    <code><br \/>\n     mylib.js<br \/>\n    <\/code><br \/>\n    \u6587\u4ef6\u624d\u80fd\u8d77\u4f5c\u7528\uff1a\u8fd9\u5c31\u662f\u4f9d\u8d56\u5173\u7cfb\u7684\u5de5\u4f5c\uff0c\u5b83\u5c06\u5305\u62ec\u6b64\u6587\u4ef6\u3002 \u4f46\uff01<br \/>\n    <code><br \/>\n     mylib.js<br \/>\n    <\/code><br \/>\n    \u6587\u4ef6\u9700\u8981jQuery\uff0c\u56e0\u6b64\u4e5f\u5305\u542bjQuery\u3002 \u4e00\u884c\u4e2d\u5305\u542b\u4e09\u4e2a\u6587\u4ef6\u3002\n   <\/p>\n<p>\n    But that\u2019s not the only advantage of the<br \/>\n    <code><br \/>\n     wp_register_script()<br \/>\n    <\/code><br \/>\n    function: if you register your scripts, other plugins will be able to use it. So if you want to make various plugins, with one which defines some libraries, the others will be able to include them.\n   <\/p>\n<p>\n    \u4f46\u8fd9\u4e0d\u662f<br \/>\n    <code><br \/>\n     wp_register_script()<br \/>\n    <\/code><br \/>\n    \u51fd\u6570\u7684\u552f\u4e00\u4f18\u70b9\uff1a\u5982\u679c\u60a8\u6ce8\u518c\u811a\u672c\uff0c\u5176\u4ed6\u63d2\u4ef6\u5c06\u53ef\u4ee5\u4f7f\u7528\u5b83\u3002 \u56e0\u6b64\uff0c\u5982\u679c\u60a8\u60f3\u5236\u4f5c\u5404\u79cd\u63d2\u4ef6\uff0c\u5e76\u4e14\u5176\u4e2d\u4e00\u4e2a\u5b9a\u4e49\u4e86\u4e00\u4e9b\u5e93\uff0c\u5219\u5176\u4ed6\u63d2\u4ef6\u5c06\u80fd\u591f\u5305\u542b\u5b83\u4eec\u3002\n   <\/p>\n<p>\n    The biggest advantage of the<br \/>\n    <code><br \/>\n     wp_enqueue_script()<br \/>\n    <\/code><br \/>\n    function is that it won\u2019t include the same script twice. For example, imagine that two files need jQuery: this files indicate it as a dependency and WordPress will include the library when the first file is included. Then the time to include the second script is here. WordPress sees jQuery as a dependency, but the library is already included, so including it again is not needed: WordPress won\u2019t do that.\n   <\/p>\n<p>\n    <code><br \/>\n     wp_enqueue_script()<br \/>\n    <\/code><br \/>\n    \u51fd\u6570\u7684\u6700\u5927\u4f18\u70b9\u662f\u5b83\u4e0d\u4f1a\u4e24\u6b21\u5305\u542b\u76f8\u540c\u7684\u811a\u672c\u3002 \u4f8b\u5982\uff0c\u5047\u8bbe\u6709\u4e24\u4e2a\u6587\u4ef6\u9700\u8981jQuery\uff1a\u6b64\u6587\u4ef6\u5c06\u5176\u8868\u793a\u4e3a\u4f9d\u8d56\u9879\uff0c\u5f53\u5305\u542b\u7b2c\u4e00\u4e2a\u6587\u4ef6\u65f6\uff0cWordPress\u5c06\u5305\u62ec\u8be5\u5e93\u3002 \u7136\u540e\u662f\u65f6\u5019\u5305\u542b\u7b2c\u4e8c\u4e2a\u811a\u672c\u4e86\u3002 WordPress\u5c06jQuery\u89c6\u4e3a\u4f9d\u8d56\u9879\uff0c\u4f46\u662f\u8be5\u5e93\u5df2\u7ecf\u5305\u542b\u5728\u5185\uff0c\u56e0\u6b64\u4e0d\u9700\u8981\u518d\u6b21\u5305\u542b\u5b83\uff1aWordPress\u4e0d\u4f1a\u8fd9\u6837\u505a\u3002\n   <\/p>\n<p>\n    The same behavior appears when you try to enqueue two scripts with different names but with the same URL. In the below example, WordPress will include the file once.\n   <\/p>\n<p>\n    \u5f53\u60a8\u5c1d\u8bd5\u4f7f\u4e24\u4e2a\u5177\u6709\u4e0d\u540c\u540d\u79f0\u4f46\u5177\u6709\u76f8\u540cURL\u7684\u811a\u672c\u5165\u961f\u65f6\uff0c\u4f1a\u51fa\u73b0\u76f8\u540c\u7684\u884c\u4e3a\u3002 \u5728\u4ee5\u4e0b\u793a\u4f8b\u4e2d\uff0cWordPress\u5c06\u4e00\u6b21\u5305\u542b\u8be5\u6587\u4ef6\u3002\n   <\/p>\n<pre class=\"has\" tabindex=\"0\"><code class=\"language-php\">wp_enqueue_script('myfile', plugin_dir_url(__FILE__) . 'myfile.js', array('mylib'));\r\nwp_enqueue_script('myotherfile', plugin_dir_url(__FILE__) . 'myfile.js');<\/code><\/pre>\n<p>\n    However, be careful: this behavior is limited: if you indicate a version number in at least one<br \/>\n    <code><br \/>\n     wp_enqueue_script()<br \/>\n    <\/code><br \/>\n    call, the script will be included twice, even if this version number is the same. The below example seems to be the same as the previous one, but it will include the file twice.\n   <\/p>\n<p>\n    \u4f46\u662f\uff0c\u8bf7\u5c0f\u5fc3\uff1a\u6b64\u884c\u4e3a\u662f\u6709\u9650\u7684\uff1a\u5982\u679c\u5728\u81f3\u5c11\u4e00\u4e2a<br \/>\n    <code><br \/>\n     wp_enqueue_script()<br \/>\n    <\/code><br \/>\n    \u8c03\u7528\u4e2d\u6307\u5b9a\u4e86\u7248\u672c\u53f7\uff0c\u5219\u5373\u4f7f\u8be5\u7248\u672c\u53f7\u76f8\u540c\uff0c\u811a\u672c\u4e5f\u4f1a\u88ab\u5305\u542b\u4e24\u6b21\u3002 \u4e0b\u9762\u7684\u793a\u4f8b\u4f3c\u4e4e\u4e0e\u4e0a\u4e00\u4e2a\u793a\u4f8b\u76f8\u540c\uff0c\u4f46\u662f\u5b83\u5c06\u5305\u542b\u8be5\u6587\u4ef6\u4e24\u6b21\u3002\n   <\/p>\n<pre class=\"has\" tabindex=\"0\"><code class=\"language-php\">wp_enqueue_script('myfile', plugin_dir_url(__FILE__) . 'myfile.js', array('mylib'), '1.0');\r\nwp_enqueue_script('myotherfile', plugin_dir_url(__FILE__) . 'myfile.js', array(), '1.0');<\/code><\/pre>\n<p>\n    That said, in general, you haven\u2019t any reason to enqueue one script with different names. But it was necessary to clarify this case.\n   <\/p>\n<p>\n    \u4e5f\u5c31\u662f\u8bf4\uff0c\u4e00\u822c\u800c\u8a00\uff0c\u60a8\u6ca1\u6709\u4efb\u4f55\u7406\u7531\u8ba9\u4e00\u4e2a\u811a\u672c\u4f7f\u7528\u4e0d\u540c\u7684\u540d\u79f0\u3002 \u4f46\u662f\u6709\u5fc5\u8981\u6f84\u6e05\u8fd9\u79cd\u60c5\u51b5\u3002\n   <\/p>\n<p>\n    As you can see,<br \/>\n    <strong><br \/>\n     this two functions are the best way to manage dependencies<br \/>\n    <\/strong><br \/>\n    : you register them and WordPress will care of the rest, automatically.\n   <\/p>\n<p>\n    \u5982\u60a8\u6240\u89c1\uff0c<br \/>\n    <strong><br \/>\n     \u8fd9\u4e24\u4e2a\u529f\u80fd\u662f\u7ba1\u7406\u4f9d\u8d56\u9879\u7684\u6700\u4f73\u65b9\u6cd5<br \/>\n    <\/strong><br \/>\n    \uff1a\u6ce8\u518c\u5b83\u4eec\uff0cWordPress\u5c06\u81ea\u52a8\u5904\u7406\u5176\u4f59\u90e8\u5206\u3002\n   <\/p>\n<p>\n    Note that we used the name \u201c<br \/>\n    <em><br \/>\n     jquery<br \/>\n    <\/em><br \/>\n    \u201d to indicate that we want to include jQuery with our own files, but we did not register it. This name is already registered by WordPress: when you download the CMS, it contains jQuery.\n   <\/p>\n<p>\n    \u8bf7\u6ce8\u610f\uff0c\u6211\u4eec\u4f7f\u7528\u540d\u79f0\u201c<br \/>\n    <em><br \/>\n     jquery<br \/>\n    <\/em><br \/>\n    \u201d\u6765\u8868\u793a\u6211\u4eec\u5e0c\u671b\u5c06jQuery\u5305\u542b\u5728\u6211\u4eec\u81ea\u5df1\u7684\u6587\u4ef6\u4e2d\uff0c\u4f46\u662f\u6211\u4eec\u6ca1\u6709\u6ce8\u518c\u5b83\u3002 \u8be5\u540d\u79f0\u5df2\u7ecf\u7531WordPress\u6ce8\u518c\uff1a\u4e0b\u8f7dCMS\u65f6\uff0c\u5b83\u5305\u542bjQuery\u3002\n   <\/p>\n<p>\n    This library is not the only one: you can find all the scripts registered by WordPress in<br \/>\n    <a href=\"http:\/\/codex.wordpress.org\/Function_Reference\/wp_enqueue_script#Default_Scripts_Included_and_Registered_by_WordPress\" rel=\"nofollow\"><br \/>\n     this page<br \/>\n    <\/a><br \/>\n    . You can enqueue them directly or via a dependency, and the cool thing is that you haven\u2019t to provide the files, so every plugin or theme which uses this scripts will use the same files: in our example, if another plugin uses jQuery, the library will only be included once.\n   <\/p>\n<p>\n    \u8fd9\u4e2a\u5e93\u4e0d\u662f\u552f\u4e00\u7684\u4e00\u4e2a\u5e93\uff1a\u60a8\u53ef\u4ee5\u5728<br \/>\n    <a href=\"http:\/\/codex.wordpress.org\/Function_Reference\/wp_enqueue_script#Default_Scripts_Included_and_Registered_by_WordPress\" rel=\"nofollow\"><br \/>\n     \u6b64\u9875\u9762\u4e2d<br \/>\n    <\/a><br \/>\n    \u627e\u5230WordPress\u6ce8\u518c\u7684\u6240\u6709\u811a\u672c\u3002 \u60a8\u53ef\u4ee5\u76f4\u63a5\u5c06\u5b83\u4eec\u6392\u5165\u961f\u5217\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u4f9d\u8d56\u5173\u7cfb\u5165\u961f\uff0c\u4f46\u5f88\u9177\u7684\u662f\uff0c\u60a8\u4e0d\u5fc5\u63d0\u4f9b\u6587\u4ef6\uff0c\u56e0\u6b64\uff0c\u4f7f\u7528\u6b64\u811a\u672c\u7684\u6bcf\u4e2a\u63d2\u4ef6\u6216\u4e3b\u9898\u90fd\u5c06\u4f7f\u7528\u76f8\u540c\u7684\u6587\u4ef6\uff1a\u5728\u6211\u4eec\u7684\u793a\u4f8b\u4e2d\uff0c\u5982\u679c\u53e6\u4e00\u4e2a\u63d2\u4ef6\u4f7f\u7528jQuery\uff0c\u8be5\u5e93\u5c06\u53ea\u5305\u542b\u4e00\u6b21\u3002\n   <\/p>\n<h3>\n    \u4e0d\u8981\u5230\u5904\u6392\u961f\u811a\u672c\uff01<br \/>\n    <span style=\"font-weight: bold;\"><br \/>\n     (<br \/>\n    <\/span><br \/>\n    Do Not Enqueue Your Scripts Everywhere!<br \/>\n    <span style=\"font-weight: bold;\"><br \/>\n     )<br \/>\n    <\/span><br \/>\n   <\/h3>\n<p>\n    The<br \/>\n    <code><br \/>\n     wp_enqueue_script()<br \/>\n    <\/code><br \/>\n    function ensures that a script is not included twice and includes it properly in the header or in the footer. But what if the displayed page does not even need your script?\n   <\/p>\n<p>\n    <code><br \/>\n     wp_enqueue_script()<br \/>\n    <\/code><br \/>\n    \u51fd\u6570\u53ef\u786e\u4fdd\u4e0d\u4e24\u6b21\u5305\u542b\u811a\u672c\uff0c\u5e76\u5c06\u5176\u6b63\u786e\u5305\u542b\u5728\u9875\u7709\u6216\u9875\u811a\u4e2d\u3002 \u4f46\u662f\uff0c\u5982\u679c\u663e\u793a\u7684\u9875\u9762\u751a\u81f3\u4e0d\u9700\u8981\u60a8\u7684\u811a\u672c\u600e\u4e48\u529e\uff1f\n   <\/p>\n<h4>\n    \u4f7f\u7528\u52a8\u4f5c\/\u8fc7\u6ee4\u5668API<br \/>\n    <span style=\"font-weight: bold;\"><br \/>\n     (<br \/>\n    <\/span><br \/>\n    Use the Action\/Filter API<br \/>\n    <span style=\"font-weight: bold;\"><br \/>\n     )<br \/>\n    <\/span><br \/>\n   <\/h4>\n<p>\n    Take the example of<br \/>\n    <a href=\"https:\/\/www.sitepoint.com\/adding-a-media-button-to-the-content-editor\/\" rel=\"nofollow\"><br \/>\n     adding a media button to the content editor<br \/>\n    <\/a><br \/>\n    : the JavaScript file is only needed when the user is on the editor. In fact, when an average visitor is reading an article, they don\u2019t need this script: including it is useless and make the page heavier.\n   <\/p>\n<p>\n    \u4ee5<br \/>\n    <a href=\"https:\/\/www.sitepoint.com\/adding-a-media-button-to-the-content-editor\/\" rel=\"nofollow\"><br \/>\n     \u5411\u5185\u5bb9\u7f16\u8f91\u5668\u6dfb\u52a0\u5a92\u4f53\u6309\u94ae<br \/>\n    <\/a><br \/>\n    \u4e3a\u4f8b\uff1a\u4ec5\u5f53\u7528\u6237\u5728\u7f16\u8f91\u5668\u4e0a\u65f6\uff0c\u624d\u9700\u8981JavaScript\u6587\u4ef6\u3002 \u5b9e\u9645\u4e0a\uff0c\u5f53\u666e\u901a\u8bbf\u95ee\u8005\u9605\u8bfb\u6587\u7ae0\u65f6\uff0c\u4ed6\u4eec\u4e0d\u9700\u8981\u6b64\u811a\u672c\uff1a\u5305\u62ec\u8be5\u811a\u672c\u662f\u6ca1\u6709\u7528\u7684\uff0c\u5e76\u4e14\u4f1a\u4f7f\u9875\u9762\u53d8\u91cd\u3002\n   <\/p>\n<p>\n    That\u2019s why, when you want to include a script into a page, ask yourself the following question: when is this script needed? Of course, the answer to this question will be different depending on what your script does.\n   <\/p>\n<p>\n    \u56e0\u6b64\uff0c\u5f53\u60a8\u8981\u5c06\u811a\u672c\u5305\u542b\u5230\u9875\u9762\u4e2d\u65f6\uff0c\u8bf7\u95ee\u81ea\u5df1\u4ee5\u4e0b\u95ee\u9898\uff1a\u4ec0\u4e48\u65f6\u5019\u9700\u8981\u6b64\u811a\u672c\uff1f \u5f53\u7136\uff0c\u6839\u636e\u811a\u672c\u7684\u4f5c\u7528\uff0c\u6b64\u95ee\u9898\u7684\u7b54\u6848\u5c06\u6709\u6240\u4e0d\u540c\u3002\n   <\/p>\n<p>\n    But once you find this answer, try to find a corresponding action. The WordPress Codex provides us<br \/>\n    <a href=\"http:\/\/codex.wordpress.org\/Plugin_API\/Action_Reference\" rel=\"nofollow\"><br \/>\n     a list of available actions<br \/>\n    <\/a><br \/>\n    , so you can find the one you search at this place. Found it? Great, create a new function which will enqueue your script(s), in the main file of your plugin or in the<br \/>\n    <code><br \/>\n     functions.php<br \/>\n    <\/code><br \/>\n    file or your theme for example.\n   <\/p>\n<p>\n    \u4f46\u662f\uff0c\u4e00\u65e6\u627e\u5230\u6b64\u7b54\u6848\uff0c\u8bf7\u5c1d\u8bd5\u627e\u5230\u76f8\u5e94\u7684\u64cd\u4f5c\u3002 WordPress Codex\u4e3a\u6211\u4eec\u63d0\u4f9b<br \/>\n    <a href=\"http:\/\/codex.wordpress.org\/Plugin_API\/Action_Reference\" rel=\"nofollow\"><br \/>\n     \u4e86\u53ef\u7528\u64cd\u4f5c\u7684\u5217\u8868<br \/>\n    <\/a><br \/>\n    \uff0c\u56e0\u6b64\u60a8\u53ef\u4ee5\u5728\u6b64\u5904\u627e\u5230\u8981\u641c\u7d22\u7684\u64cd\u4f5c\u3002 \u627e\u5230\u4e86\uff1f \u592a\u597d\u4e86\uff0c\u5728\u63d2\u4ef6\u7684\u4e3b\u6587\u4ef6\u4e2d\u6216\u5728<br \/>\n    <code><br \/>\n     functions.php<br \/>\n    <\/code><br \/>\n    \u6587\u4ef6\u6216\u4e3b\u9898\u4e2d\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u51fd\u6570\u6765\u6392\u961f\u60a8\u7684\u811a\u672c\u3002\n   <\/p>\n<pre class=\"has\" tabindex=\"0\"><code class=\"language-php\">function enqueue_my_scripts() {\r\n    wp_enqueue_script('script0', plugin_dir_url(__FILE__) . 'lib\/myscript.js', array('jquery'));\r\n    wp_enqueue_script('script1', plugin_dir_url(__FILE__) . 'another-script.js');\r\n}<\/code><\/pre>\n<p>\n    Then, make it run when your action is triggered:\n   <\/p>\n<p>\n    \u7136\u540e\uff0c\u4f7f\u5176\u5728\u89e6\u53d1\u64cd\u4f5c\u65f6\u8fd0\u884c\uff1a\n   <\/p>\n<pre class=\"has\" tabindex=\"0\"><code class=\"language-php\">add_action('the_right_action', 'enqueue_my_scripts');<\/code><\/pre>\n<p>\n    For example, when we wanted to add a media button, we used the<br \/>\n    <code><br \/>\n     wp_enqueue_media<br \/>\n    <\/code><br \/>\n    action, which was perfect:\n   <\/p>\n<p>\n    \u4f8b\u5982\uff0c\u5f53\u6211\u4eec\u60f3\u6dfb\u52a0\u4e00\u4e2a\u5a92\u4f53\u6309\u94ae\u65f6\uff0c\u6211\u4eec\u4f7f\u7528\u4e86<br \/>\n    <code><br \/>\n     wp_enqueue_media<br \/>\n    <\/code><br \/>\n    \u64cd\u4f5c\uff0c\u8fd9\u662f\u5b8c\u7f8e\u7684\uff1a\n   <\/p>\n<pre class=\"has\" tabindex=\"0\"><code class=\"language-php\">add_action('wp_enqueue_media', 'include_media_button_js_file');<\/code><\/pre>\n<p>\n    If you tried to search this action in the reference linked above, you probably found nothing: at the time or writing this lines,<br \/>\n    <code><br \/>\n     wp_enqueue_media<br \/>\n    <\/code><br \/>\n    is not listed. This list is not exhaustive, but it is a good place to begin with.\n   <\/p>\n<p>\n    \u5982\u679c\u60a8\u5c1d\u8bd5\u5728\u4e0a\u9762\u94fe\u63a5\u7684\u53c2\u8003\u4e2d\u641c\u7d22\u6b64\u64cd\u4f5c\uff0c\u5219\u53ef\u80fd\u627e\u4e0d\u5230\u4efb\u4f55\u5185\u5bb9\uff1a\u5728\u5f53\u65f6\u6216\u7f16\u5199\u6b64<br \/>\n    <code><br \/>\n     wp_enqueue_media<br \/>\n    <\/code><br \/>\n    \uff0c\u672a\u5217\u51fa<br \/>\n    <code><br \/>\n     wp_enqueue_media<br \/>\n    <\/code><br \/>\n    \u3002 \u6b64\u5217\u8868\u5e76\u4e0d\u8be6\u5c3d\uff0c\u4f46\u662f\u5b83\u662f\u4e00\u4e2a\u5f88\u597d\u7684\u8d77\u70b9\u3002\n   <\/p>\n<p>\n    If you don\u2019t find the right action, maybe you can find another which has a close behavior, or maybe you should try to search<br \/>\n    <a href=\"http:\/\/codex.wordpress.org\/Plugin_API\/Filter_Reference\" rel=\"nofollow\"><br \/>\n     in the filters<br \/>\n    <\/a><br \/>\n    instead.\n   <\/p>\n<p>\n    \u5982\u679c\u627e\u4e0d\u5230\u6b63\u786e\u7684\u64cd\u4f5c\uff0c\u5219\u53ef\u80fd\u4f1a\u627e\u5230\u53e6\u4e00\u4e2a\u884c\u4e3a\u63a5\u8fd1\u7684\u64cd\u4f5c\uff0c\u6216\u8005\u60a8\u5e94\u8be5\u5c1d\u8bd5<br \/>\n    <a href=\"http:\/\/codex.wordpress.org\/Plugin_API\/Filter_Reference\" rel=\"nofollow\"><br \/>\n     \u5728\u8fc7\u6ee4\u5668\u4e2d<br \/>\n    <\/a><br \/>\n    \u8fdb\u884c\u641c\u7d22\u3002\n   <\/p>\n<h4>\n    \u4f7f\u7528WordPress\u529f\u80fd\u7684\u5f3a\u5927\u529f\u80fd\uff01<br \/>\n    <span style=\"font-weight: bold;\"><br \/>\n     (<br \/>\n    <\/span><br \/>\n    Use the Power of WordPress\u2019 Functions!<br \/>\n    <span style=\"font-weight: bold;\"><br \/>\n     )<br \/>\n    <\/span><br \/>\n   <\/h4>\n<p>\n    Often, plugins are made for a specific reason, one that cannot use the Action\/Filter API, or not completely. For instance, a plugin can modify some elements into a post, but not in all of them:<br \/>\n    <a href=\"https:\/\/www.sitepoint.com\/unleash-the-power-of-the-wordpress-shortcode-api\/\" rel=\"nofollow\"><br \/>\n     shortcodes<br \/>\n    <\/a><br \/>\n    are a typical example of this.\n   <\/p>\n<p>\n    \u901a\u5e38\uff0c\u63d2\u4ef6\u662f\u51fa\u4e8e\u7279\u5b9a\u539f\u56e0\u800c\u5236\u4f5c\u7684\uff0c\u8fd9\u4e9b\u539f\u56e0\u4e0d\u80fd\u4f7f\u7528Action \/ Filter API\uff0c\u6216\u8005\u4e0d\u80fd\u5b8c\u5168\u4f7f\u7528\u3002 \u4f8b\u5982\uff0c\u63d2\u4ef6\u53ef\u4ee5\u5c06\u67d0\u4e9b\u5143\u7d20\u4fee\u6539\u4e3a\u5e16\u5b50\uff0c\u4f46\u4e0d\u80fd\u5c06\u6240\u6709\u5143\u7d20\u90fd\u4fee\u6539\u4e3a\uff1a<br \/>\n    <a href=\"https:\/\/www.sitepoint.com\/unleash-the-power-of-the-wordpress-shortcode-api\/\" rel=\"nofollow\"><br \/>\n     \u77ed\u4ee3\u7801<br \/>\n    <\/a><br \/>\n    \u662f\u8fd9\u79cd\u60c5\u51b5\u7684\u5178\u578b\u793a\u4f8b\u3002\n   <\/p>\n<p>\n    Assume that your plugin needs some scripts used by the code which replaces a shortcode. There is no action or filter which will precisely target your shortcode. But there is a place where you can be sure that your shortcode has been found, where you can be sure that your scripts are needed.\n   <\/p>\n<p>\n    \u5047\u8bbe\u60a8\u7684\u63d2\u4ef6\u9700\u8981\u66ff\u6362\u77ed\u4ee3\u7801\u7684\u4ee3\u7801\u4f7f\u7528\u7684\u4e00\u4e9b\u811a\u672c\u3002 \u6ca1\u6709\u4efb\u4f55\u64cd\u4f5c\u6216\u8fc7\u6ee4\u5668\u53ef\u4ee5\u7cbe\u786e\u5b9a\u4f4d\u60a8\u7684\u77ed\u4ee3\u7801\u3002 \u4f46\u662f\u5728\u67d0\u4e2a\u5730\u65b9\uff0c\u60a8\u53ef\u4ee5\u786e\u4fdd\u627e\u5230\u4e86\u60a8\u7684\u77ed\u4ee3\u7801\uff0c\u5e76\u4e14\u53ef\u4ee5\u5728\u5176\u4e2d\u786e\u4fdd\u9700\u8981\u811a\u672c\u3002\n   <\/p>\n<p>\n    This place is the callback function called by WordPress each time your shortcode is found. Call<br \/>\n    <code><br \/>\n     wp_enqueue_script()<br \/>\n    <\/code><br \/>\n    into this callback function and your scripts won\u2019t be included unless there are needed.\n   <\/p>\n<p>\n    \u6bcf\u6b21\u627e\u5230\u60a8\u7684\u77ed\u4ee3\u7801\u65f6\uff0c\u6b64\u5730\u65b9\u5c31\u662fWordPress\u8c03\u7528\u7684\u56de\u8c03\u51fd\u6570\u3002 \u5728\u6b64\u56de\u8c03\u51fd\u6570\u4e2d\u8c03\u7528<br \/>\n    <code><br \/>\n     wp_enqueue_script()<br \/>\n    <\/code><br \/>\n    \u9664\u975e\u9700\u8981\uff0c\u5426\u5219\u4e0d\u4f1a\u5305\u542b\u60a8\u7684\u811a\u672c\u3002\n   <\/p>\n<p>\n    But, what if your shortcode has been found twice or more? The answer is simple: nothing.\n   <\/p>\n<p>\n    \u4f46\u662f\uff0c\u5982\u679c\u60a8\u7684\u7b80\u7801\u88ab\u53d1\u73b0\u4e24\u6b21\u6216\u66f4\u591a\u6b21\u600e\u4e48\u529e\uff1f \u7b54\u6848\u5f88\u7b80\u5355\uff1a\u6ca1\u6709\u3002\n   <\/p>\n<p>\n    In fact, try to call the<br \/>\n    <code><br \/>\n     wp_enqueue_script()<br \/>\n    <\/code><br \/>\n    function twice, with the same script: this script will only be included once, and that\u2019s why this function is a very good tool.\n   <\/p>\n<p>\n    \u5b9e\u9645\u4e0a\uff0c\u8bf7\u5c1d\u8bd5\u4f7f\u7528\u76f8\u540c\u7684\u811a\u672c\u4e24\u6b21\u8c03\u7528<br \/>\n    <code><br \/>\n     wp_enqueue_script()<br \/>\n    <\/code><br \/>\n    \u51fd\u6570\uff1a\u8be5\u811a\u672c\u4ec5\u88ab\u5305\u542b\u4e00\u6b21\uff0c\u56e0\u6b64\u8fd9\u662f\u4e00\u4e2a\u975e\u5e38\u597d\u7684\u5de5\u5177\u3002\n   <\/p>\n<p>\n    So you can insert this call into your callback function or into every other part of your plugin or theme where you can be sure that your scripts are needed: even if they are needed several times, they will only be included once.\n   <\/p>\n<p>\n    \u56e0\u6b64\uff0c\u60a8\u53ef\u4ee5\u5c06\u6b64\u8c03\u7528\u63d2\u5165\u56de\u8c03\u51fd\u6570\u6216\u63d2\u4ef6\u6216\u4e3b\u9898\u7684\u6240\u6709\u5176\u4ed6\u90e8\u5206\uff0c\u4ee5\u786e\u4fdd\u9700\u8981\u4f7f\u7528\u811a\u672c\uff1a\u5373\u4f7f\u591a\u6b21\u9700\u8981\u4f7f\u7528\u5b83\u4eec\uff0c\u5b83\u4eec\u4e5f\u53ea\u4f1a\u88ab\u5305\u542b\u4e00\u6b21\u3002\n   <\/p>\n<p>\n    Note that, depending on the place where your<br \/>\n    <code><br \/>\n     wp_enqueue_script()<br \/>\n    <\/code><br \/>\n    call is done, it can be too late to ask WordPress to include them into the<br \/>\n    <code><br \/>\n     head<br \/>\n    <\/code><br \/>\n    tag: your only choice will be the footer. If your script must be in the<br \/>\n    <code><br \/>\n     head<br \/>\n    <\/code><br \/>\n    tag for an obscure reason, think about it.\n   <\/p>\n<p>\n    \u8bf7\u6ce8\u610f\uff0c\u6839\u636e\u5b8c\u6210<br \/>\n    <code><br \/>\n     wp_enqueue_script()<br \/>\n    <\/code><br \/>\n    \u8c03\u7528\u7684\u4f4d\u7f6e\uff0c\u8981\u6c42WordPress\u5c06\u5b83\u4eec\u5305\u62ec\u5728<br \/>\n    <code><br \/>\n     head<br \/>\n    <\/code><br \/>\n    \u6807\u7b7e\u4e2d\u53ef\u80fd\u4e3a\u65f6\u5df2\u665a\uff1a\u60a8\u552f\u4e00\u7684\u9009\u62e9\u5c06\u662f\u9875\u811a\u3002 \u5982\u679c\u60a8\u7684\u811a\u672c\u51fa\u4e8e\u67d0\u79cd\u6666\u6da9\u7684\u539f\u56e0\u800c\u5fc5\u987b\u653e\u5728<br \/>\n    <code><br \/>\n     head<br \/>\n    <\/code><br \/>\n    \u6807\u8bb0\u4e2d\uff0c\u8bf7\u8003\u8651\u4e00\u4e0b\u3002\n   <\/p>\n<p>\n    Maybe you have a question now: when is it too late?\n   <\/p>\n<p>\n    \u4e5f\u8bb8\u60a8\u73b0\u5728\u6709\u4e00\u4e2a\u95ee\u9898\uff1a\u4ec0\u4e48\u65f6\u5019\u4e3a\u65f6\u5df2\u665a\uff1f\n   <\/p>\n<p>\n    Every theme must use two specific functions:<br \/>\n    <code><br \/>\n     wp_head()<br \/>\n    <\/code><br \/>\n    and<br \/>\n    <code><br \/>\n     wp_footer()<br \/>\n    <\/code><br \/>\n    . When the former is called, WordPress will add automatically all the lines needed in the<br \/>\n    <code><br \/>\n     head<br \/>\n    <\/code><br \/>\n    tag: if you asked for the inclusion of your scripts in the<br \/>\n    <code><br \/>\n     head<br \/>\n    <\/code><br \/>\n    tag, they will be included when<br \/>\n    <code><br \/>\n     wp_head()<br \/>\n    <\/code><br \/>\n    is called, so if you ask this inclusion after the<br \/>\n    <code><br \/>\n     wp_head()<br \/>\n    <\/code><br \/>\n    call, your scripts won\u2019t be included in the<br \/>\n    <code><br \/>\n     head<br \/>\n    <\/code><br \/>\n    tag.\n   <\/p>\n<p>\n    \u6bcf\u4e2a\u4e3b\u9898\u5fc5\u987b\u4f7f\u7528\u4e24\u4e2a\u7279\u5b9a\u7684\u51fd\u6570\uff1a<br \/>\n    <code><br \/>\n     wp_head()<br \/>\n    <\/code><br \/>\n    \u548c<br \/>\n    <code><br \/>\n     wp_footer()<br \/>\n    <\/code><br \/>\n    \u3002 \u8c03\u7528\u524d\u8005\u65f6\uff0cWordPress\u5c06\u81ea\u52a8\u6dfb\u52a0<br \/>\n    <code><br \/>\n     head<br \/>\n    <\/code><br \/>\n    \u6807\u8bb0\u4e2d\u6240\u9700\u7684\u6240\u6709\u884c\uff1a\u5982\u679c\u60a8\u8981\u6c42\u5c06\u811a\u672c\u5305\u542b\u5728<br \/>\n    <code><br \/>\n     head<br \/>\n    <\/code><br \/>\n    \u6807\u8bb0\u4e2d\uff0c\u5219\u5728<br \/>\n    <code><br \/>\n     wp_head()<br \/>\n    <\/code><br \/>\n    \u65f6\u5c06\u5305\u542b\u5b83\u4eec\uff0c\u56e0\u6b64\uff0c\u5982\u679c\u60a8\u8981\u6c42\u5305\u542b\u5728<br \/>\n    <code><br \/>\n     wp_head()<br \/>\n    <\/code><br \/>\n    \u8c03\u7528\u4e4b\u540e\uff0c\u60a8\u7684\u811a\u672c\u5c06\u4e0d\u4f1a\u5305\u542b\u5728<br \/>\n    <code><br \/>\n     head<br \/>\n    <\/code><br \/>\n    \u6807\u7b7e\u4e2d\u3002\n   <\/p>\n<p>\n    But WordPress is smart, and your scripts will still be included: you will be able to retrieve them in the footer, when the<br \/>\n    <code><br \/>\n     wp_footer()<br \/>\n    <\/code><br \/>\n    function is called and when the scripts which must be included at this place are included.\n   <\/p>\n<p>\n    \u4f46\u662fWordPress\u5f88\u806a\u660e\uff0c\u5e76\u4e14\u60a8\u7684\u811a\u672c\u4ecd\u5c06\u5305\u62ec\u5728\u5185\uff1a\u5f53<br \/>\n    <code><br \/>\n     wp_footer()<br \/>\n    <\/code><br \/>\n    \u51fd\u6570\u4ee5\u53ca\u5fc5\u987b\u5305\u542b\u5728\u6b64\u4f4d\u7f6e\u7684\u811a\u672c\u65f6\uff0c\u60a8\u5c06\u53ef\u4ee5\u5728\u9875\u811a\u4e2d\u68c0\u7d22\u5b83\u4eec\u3002\n   <\/p>\n<p>\n    So you have your answer: if you absolutely want to include your script in the<br \/>\n    <code><br \/>\n     head<br \/>\n    <\/code><br \/>\n    tag, ask for the inclusion before the<br \/>\n    <code><br \/>\n     wp_head()<br \/>\n    <\/code><br \/>\n    call which should be at the end of the<br \/>\n    <code><br \/>\n     head<br \/>\n    <\/code><br \/>\n    tag in the theme. The<br \/>\n    <code><br \/>\n     wp_footer()<br \/>\n    <\/code><br \/>\n    call should be at the very end of the document, before the end of the<br \/>\n    <code><br \/>\n     body<br \/>\n    <\/code><br \/>\n    tag.\n   <\/p>\n<p>\n    \u56e0\u6b64\uff0c\u60a8\u6709\u4e00\u4e2a\u7b54\u6848\uff1a\u5982\u679c\u60a8\u7edd\u5bf9\u5e0c\u671b\u5c06\u811a\u672c\u5305\u542b\u5728<br \/>\n    <code><br \/>\n     head<br \/>\n    <\/code><br \/>\n    \u6807\u8bb0\u4e2d\uff0c\u8bf7\u5728<br \/>\n    <code><br \/>\n     wp_head()<br \/>\n    <\/code><br \/>\n    \u8c03\u7528\u4e4b\u524d\u8981\u6c42\u5c06\u5176\u5305\u542b\u5728\u4e3b\u9898\u4e2d\u7684<br \/>\n    <code><br \/>\n     head<br \/>\n    <\/code><br \/>\n    \u6807\u8bb0\u7684\u672b\u5c3e\u3002<br \/>\n    <code><br \/>\n     wp_footer()<br \/>\n    <\/code><br \/>\n    \u8c03\u7528\u5e94\u4f4d\u4e8e\u6587\u6863\u7684\u672b\u5c3e\uff0c\u4f4d\u4e8e<br \/>\n    <code><br \/>\n     body<br \/>\n    <\/code><br \/>\n    \u6807\u8bb0\u7684\u672b\u5c3e\u3002\n   <\/p>\n<h3>\n    \u7ed3\u8bba<br \/>\n    <span style=\"font-weight: bold;\"><br \/>\n     (<br \/>\n    <\/span><br \/>\n    Conclusion<br \/>\n    <span style=\"font-weight: bold;\"><br \/>\n     )<br \/>\n    <\/span><br \/>\n   <\/h3>\n<p>\n    Your scripts are useful for what your plugin or theme does in a specific place, but including them into pages where they are not needed will make this same pages unnecessarily heavier.\n   <\/p>\n<p>\n    \u60a8\u7684\u811a\u672c\u5bf9\u4e8e\u60a8\u7684\u63d2\u4ef6\u6216\u4e3b\u9898\u5728\u7279\u5b9a\u4f4d\u7f6e\u7684\u4f5c\u7528\u5f88\u6709\u7528\uff0c\u4f46\u5c06\u811a\u672c\u5305\u542b\u5728\u4e0d\u9700\u8981\u7684\u9875\u9762\u4e2d\u4f1a\u4f7f\u8fd9\u4e9b\u9875\u9762\u4e0d\u5fc5\u8981\u5730\u53d8\u91cd\u3002\n   <\/p>\n<p>\n    WordPress provides us with several tools to let us include our scripts properly, only when they are needed. The only question to ask when you want to use these tools is the following: when or where are my scripts needed? The rest depends on the answer: finding an action or a filter, placing the<br \/>\n    <code><br \/>\n     wp_enqueue_script()<br \/>\n    <\/code><br \/>\n    call into the right function, using the power of this function, or combining all of that.\n   <\/p>\n<p>\n    WordPress\u4e3a\u6211\u4eec\u63d0\u4f9b\u4e86\u51e0\u79cd\u5de5\u5177\uff0c\u8ba9\u6211\u4eec\u4ec5\u5728\u9700\u8981\u65f6\u624d\u6b63\u786e\u5305\u542b\u811a\u672c\u3002 \u4f55\u65f6\u8981\u4f7f\u7528\u8fd9\u4e9b\u5de5\u5177\u65f6\u8981\u95ee\u7684\u552f\u4e00\u95ee\u9898\u662f\uff1a\u4ec0\u4e48\u65f6\u5019\u9700\u8981\u6211\u7684\u811a\u672c\uff1f \u5176\u4f59\u7684\u53d6\u51b3\u4e8e\u7b54\u6848\uff1a\u627e\u5230\u4e00\u4e2a\u52a8\u4f5c\u6216\u4e00\u4e2a\u8fc7\u6ee4\u5668\uff0c\u5c06<br \/>\n    <code><br \/>\n     wp_enqueue_script()<br \/>\n    <\/code><br \/>\n    \u8c03\u7528\u653e\u5230\u6b63\u786e\u7684\u51fd\u6570\u4e2d\uff0c\u4f7f\u7528\u6b64\u51fd\u6570\u7684\u529f\u80fd\uff0c\u6216\u5c06\u6240\u6709\u8fd9\u4e9b\u529f\u80fd\u7ec4\u5408\u5728\u4e00\u8d77\u3002\n   <\/p>\n<p>\n    You can retrieve some examples described above in a<br \/>\n    <a href=\"http:\/\/jeremyheleine.me\/downloads\/sitepoint-scripts.zip\" rel=\"nofollow\"><br \/>\n     test plugin available right here<br \/>\n    <\/a><br \/>\n    . It enqueues a script and a \u2018library\u2019, and it creates a shortcode using another useless script.\n   <\/p>\n<p>\n    \u60a8\u53ef\u4ee5\u5728<br \/>\n    <a href=\"http:\/\/jeremyheleine.me\/downloads\/sitepoint-scripts.zip\" rel=\"nofollow\"><br \/>\n     \u6b64\u5904\u63d0\u4f9b<br \/>\n    <\/a><br \/>\n    \u7684<br \/>\n    <a href=\"http:\/\/jeremyheleine.me\/downloads\/sitepoint-scripts.zip\" rel=\"nofollow\"><br \/>\n     \u6d4b\u8bd5\u63d2\u4ef6\u4e2d<br \/>\n    <\/a><br \/>\n    \u68c0\u7d22\u4e0a\u8ff0\u793a\u4f8b\u3002 \u5b83\u6392\u961f\u4e00\u4e2a\u811a\u672c\u548c\u4e00\u4e2a\u201c\u5e93\u201d\uff0c\u5e76\u4f7f\u7528\u53e6\u4e00\u4e2a\u65e0\u7528\u7684\u811a\u672c\u521b\u5efa\u4e00\u4e2a\u7b80\u7801\u3002\n   <\/p>\n<blockquote>\n<p>\n     \u7ffb\u8bd1\u81ea:<br \/>\n     <a href=\"https:\/\/www.sitepoint.com\/including-javascript-in-plugins-or-themes\/\" rel=\"nofollow\"><br \/>\n      https:\/\/www.sitepoint.com\/including-javascript-in-plugins-or-themes\/<br \/>\n     <\/a>\n    <\/p>\n<\/blockquote>\n<p>\n    javascript\u63d2\u4ef6\n   <\/p>\n<\/section><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>javascript\u63d2\u4ef6 At the time of writing, more than 33,000 p [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":215,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-4026","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-15"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>javascript\u63d2\u4ef6_\u4ee5\u6b63\u786e\u7684\u65b9\u5f0f\u5728\u63d2\u4ef6\u6216\u4e3b\u9898\u4e2d\u5305\u542bJavaScript - \u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript\u63d2\u4ef6_\u4ee5\u6b63\u786e\u7684\u65b9\u5f0f\u5728\u63d2\u4ef6\u6216\u4e3b\u9898\u4e2d\u5305\u542bjavascript\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"javascript\u63d2\u4ef6_\u4ee5\u6b63\u786e\u7684\u65b9\u5f0f\u5728\u63d2\u4ef6\u6216\u4e3b\u9898\u4e2d\u5305\u542bJavaScript - \u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51\" \/>\n<meta property=\"og:description\" content=\"javascript\u63d2\u4ef6 At the time of writing, more than 33,000 p [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript\u63d2\u4ef6_\u4ee5\u6b63\u786e\u7684\u65b9\u5f0f\u5728\u63d2\u4ef6\u6216\u4e3b\u9898\u4e2d\u5305\u542bjavascript\/\" \/>\n<meta property=\"og:site_name\" content=\"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51\" \/>\n<meta property=\"article:published_time\" content=\"2025-06-24T04:00:01+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"260\" \/>\n\t<meta property=\"og:image:height\" content=\"180\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"admin@wunen\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin@wunen\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"13 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/\"},\"author\":{\"name\":\"admin@wunen\",\"@id\":\"https:\/\/www.wunen.com\/#\/schema\/person\/d5f7a6cf545656a9c90d507e64452db8\"},\"headline\":\"javascript\u63d2\u4ef6_\u4ee5\u6b63\u786e\u7684\u65b9\u5f0f\u5728\u63d2\u4ef6\u6216\u4e3b\u9898\u4e2d\u5305\u542bJavaScript\",\"datePublished\":\"2025-06-24T04:00:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/\"},\"wordCount\":2176,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.wunen.com\/#organization\"},\"image\":{\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg\",\"articleSection\":[\"\u4e3b\u9898\u63d2\u4ef6\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/\",\"url\":\"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/\",\"name\":\"javascript\u63d2\u4ef6_\u4ee5\u6b63\u786e\u7684\u65b9\u5f0f\u5728\u63d2\u4ef6\u6216\u4e3b\u9898\u4e2d\u5305\u542bJavaScript - \u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51\",\"isPartOf\":{\"@id\":\"https:\/\/www.wunen.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/#primaryimage\"},\"image\":{\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg\",\"datePublished\":\"2025-06-24T04:00:01+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/#primaryimage\",\"url\":\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg\",\"contentUrl\":\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg\",\"width\":260,\"height\":180},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wunen.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"javascript\u63d2\u4ef6_\u4ee5\u6b63\u786e\u7684\u65b9\u5f0f\u5728\u63d2\u4ef6\u6216\u4e3b\u9898\u4e2d\u5305\u542bJavaScript\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wunen.com\/#website\",\"url\":\"https:\/\/www.wunen.com\/\",\"name\":\"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51\",\"description\":\"\u8f6f\u4ef6\u8d44\u8baf\u6765\u7269\u5ae9\",\"publisher\":{\"@id\":\"https:\/\/www.wunen.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wunen.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.wunen.com\/#organization\",\"name\":\"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51\",\"url\":\"https:\/\/www.wunen.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wunen.com\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/cropped-\u7269\u5ae9-1.png\",\"contentUrl\":\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/cropped-\u7269\u5ae9-1.png\",\"width\":1024,\"height\":1024,\"caption\":\"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51\"},\"image\":{\"@id\":\"https:\/\/www.wunen.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wunen.com\/#\/schema\/person\/d5f7a6cf545656a9c90d507e64452db8\",\"name\":\"admin@wunen\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wunen.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d90ec1e3faf77c4d4e66e40c29b85ff6401161e0502f401dae2f0e25b38ce25e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d90ec1e3faf77c4d4e66e40c29b85ff6401161e0502f401dae2f0e25b38ce25e?s=96&d=mm&r=g\",\"caption\":\"admin@wunen\"},\"sameAs\":[\"http:\/\/www.wunen.com\"],\"url\":\"http:\/\/www.wunen.com\/index.php\/author\/adminwunen\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"javascript\u63d2\u4ef6_\u4ee5\u6b63\u786e\u7684\u65b9\u5f0f\u5728\u63d2\u4ef6\u6216\u4e3b\u9898\u4e2d\u5305\u542bJavaScript - \u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript\u63d2\u4ef6_\u4ee5\u6b63\u786e\u7684\u65b9\u5f0f\u5728\u63d2\u4ef6\u6216\u4e3b\u9898\u4e2d\u5305\u542bjavascript\/","og_locale":"zh_CN","og_type":"article","og_title":"javascript\u63d2\u4ef6_\u4ee5\u6b63\u786e\u7684\u65b9\u5f0f\u5728\u63d2\u4ef6\u6216\u4e3b\u9898\u4e2d\u5305\u542bJavaScript - \u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51","og_description":"javascript\u63d2\u4ef6 At the time of writing, more than 33,000 p [&hellip;]","og_url":"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript\u63d2\u4ef6_\u4ee5\u6b63\u786e\u7684\u65b9\u5f0f\u5728\u63d2\u4ef6\u6216\u4e3b\u9898\u4e2d\u5305\u542bjavascript\/","og_site_name":"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51","article_published_time":"2025-06-24T04:00:01+00:00","og_image":[{"width":260,"height":180,"url":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg","type":"image\/jpeg"}],"author":"admin@wunen","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin@wunen","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"13 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/#article","isPartOf":{"@id":"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/"},"author":{"name":"admin@wunen","@id":"https:\/\/www.wunen.com\/#\/schema\/person\/d5f7a6cf545656a9c90d507e64452db8"},"headline":"javascript\u63d2\u4ef6_\u4ee5\u6b63\u786e\u7684\u65b9\u5f0f\u5728\u63d2\u4ef6\u6216\u4e3b\u9898\u4e2d\u5305\u542bJavaScript","datePublished":"2025-06-24T04:00:01+00:00","mainEntityOfPage":{"@id":"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/"},"wordCount":2176,"commentCount":0,"publisher":{"@id":"https:\/\/www.wunen.com\/#organization"},"image":{"@id":"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/#primaryimage"},"thumbnailUrl":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg","articleSection":["\u4e3b\u9898\u63d2\u4ef6"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/#respond"]}]},{"@type":"WebPage","@id":"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/","url":"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/","name":"javascript\u63d2\u4ef6_\u4ee5\u6b63\u786e\u7684\u65b9\u5f0f\u5728\u63d2\u4ef6\u6216\u4e3b\u9898\u4e2d\u5305\u542bJavaScript - \u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51","isPartOf":{"@id":"https:\/\/www.wunen.com\/#website"},"primaryImageOfPage":{"@id":"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/#primaryimage"},"image":{"@id":"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/#primaryimage"},"thumbnailUrl":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg","datePublished":"2025-06-24T04:00:01+00:00","breadcrumb":{"@id":"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/"]}]},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/#primaryimage","url":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg","contentUrl":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg","width":260,"height":180},{"@type":"BreadcrumbList","@id":"http:\/\/www.wunen.com\/index.php\/2025\/06\/24\/javascript%e6%8f%92%e4%bb%b6_%e4%bb%a5%e6%ad%a3%e7%a1%ae%e7%9a%84%e6%96%b9%e5%bc%8f%e5%9c%a8%e6%8f%92%e4%bb%b6%e6%88%96%e4%b8%bb%e9%a2%98%e4%b8%ad%e5%8c%85%e5%90%abjavascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wunen.com\/"},{"@type":"ListItem","position":2,"name":"javascript\u63d2\u4ef6_\u4ee5\u6b63\u786e\u7684\u65b9\u5f0f\u5728\u63d2\u4ef6\u6216\u4e3b\u9898\u4e2d\u5305\u542bJavaScript"}]},{"@type":"WebSite","@id":"https:\/\/www.wunen.com\/#website","url":"https:\/\/www.wunen.com\/","name":"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51","description":"\u8f6f\u4ef6\u8d44\u8baf\u6765\u7269\u5ae9","publisher":{"@id":"https:\/\/www.wunen.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wunen.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":"Organization","@id":"https:\/\/www.wunen.com\/#organization","name":"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51","url":"https:\/\/www.wunen.com\/","logo":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wunen.com\/#\/schema\/logo\/image\/","url":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/cropped-\u7269\u5ae9-1.png","contentUrl":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/cropped-\u7269\u5ae9-1.png","width":1024,"height":1024,"caption":"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51"},"image":{"@id":"https:\/\/www.wunen.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.wunen.com\/#\/schema\/person\/d5f7a6cf545656a9c90d507e64452db8","name":"admin@wunen","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wunen.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d90ec1e3faf77c4d4e66e40c29b85ff6401161e0502f401dae2f0e25b38ce25e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d90ec1e3faf77c4d4e66e40c29b85ff6401161e0502f401dae2f0e25b38ce25e?s=96&d=mm&r=g","caption":"admin@wunen"},"sameAs":["http:\/\/www.wunen.com"],"url":"http:\/\/www.wunen.com\/index.php\/author\/adminwunen\/"}]}},"_links":{"self":[{"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/posts\/4026","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/comments?post=4026"}],"version-history":[{"count":0,"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/posts\/4026\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/media\/215"}],"wp:attachment":[{"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/media?parent=4026"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/categories?post=4026"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/tags?post=4026"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}