{"id":5517,"date":"2024-04-21T15:01:15","date_gmt":"2024-04-21T07:01:15","guid":{"rendered":"https:\/\/www.baishitou.cn\/?p=5517"},"modified":"2024-04-21T15:01:15","modified_gmt":"2024-04-21T07:01:15","slug":"%e7%bb%87%e6%a2%a6dedecms%e6%96%87%e6%a1%a3%e5%86%85%e5%ae%b9%e5%9b%be%e7%89%87%e8%87%aa%e5%8a%a8%e6%b7%bb%e5%8a%a0a%e9%93%be%e6%8e%a5%e5%b9%b6%e5%9c%a8%e6%96%b0%e7%aa%97%e5%8f%a3%e6%89%93%e5%bc%80","status":"publish","type":"post","link":"https:\/\/www.baishitou.cn\/5517.html","title":{"rendered":"\u7ec7\u68a6(DEDECMS)\u6587\u6863\u5185\u5bb9\u56fe\u7247\u81ea\u52a8\u6dfb\u52a0a\u94fe\u63a5\u5e76\u5728\u65b0\u7a97\u53e3\u6253\u5f00\u56fe\u7247"},"content":{"rendered":"

\u7ec7\u68a6(DEDECMS)\u6587\u6863\u5185\u5bb9\u56fe\u7247\u81ea\u52a8\u6dfb\u52a0a\u94fe\u63a5\u5e76\u5728\u65b0\u7a97\u53e3\u6253\u5f00\u56fe\u7247<\/p>\n

\u4fee\u6539\u4e4b\u524d<\/h2>\n

\"10303645H-0\"<\/p>\n

\u4fee\u6539\u4e4b\u540e<\/h2>\n

\"10303A5X-1\"<\/p>\n

\u65b9\u6cd5\u4e00\uff1ajquery<\/h2>\n
<script<\/span> type<\/span>=\"text\/javascript\"<\/span>><\/span>\r\n    $(function<\/span>() {\r\n        $('.show-article img'<\/span>).each<\/span>(function<\/span>(i<\/span>){\r\n            if<\/span> (!this<\/span>.parentNode<\/span>.href<\/span>) {\r\n                $(this<\/span>).wrap<\/span>(\"<a href='\"<\/span>+this<\/span>.src<\/span>+\"' target='_blank'><\/a>\"<\/span>);\r\n            }\r\n        });\r\n    });\r\n<\/span><\/script<\/span>><\/span><\/code><\/pre>\n

\u6ce8\u610f\uff1a<\/p>\n

1\u3001\u524d\u63d0\u662f\u4f60\u5f53\u524d\u9875\u9762\u6709jquery\u5e93<\/p>\n

2\u3001\u4f60\u7684\u6587\u6863\u5185\u5bb9\u5916\u56f4div\u91cc\u7684class\u6216\u8005id\uff0c\u6539\u6210\u81ea\u5df1\u7684<\/p>\n

\"1030362335-2\"<\/p>\n

\u65b9\u6cd5\u4e8c\uff1aPHP<\/h2>\n

1\u3001\u5728 \/include\/extend.func.php \u6700\u4e0b\u9762\u52a0\u5165<\/p>\n

\/**\r\n *  \u6587\u6863\u5185\u5bb9\u56fe\u7247\u81ea\u52a8\u6dfb\u52a0a\u94fe\u63a5\u65b0\u7a97\u53e3\u6253\u5f00\u56fe\u7247\r\n *\r\n * @access<\/span>    public\r\n * @param<\/span>     string $body \u5185\u5bb9\r\n * @return<\/span>    string\r\n *\/<\/span>\r\nfunction<\/span> setBodyimg<\/span>($body<\/span><\/span>)\r\n<\/span>{\r\n    $matches<\/span> = array<\/span>();\r\n    preg_match_all<\/span>('\/<img[^>]*src\\s*=\\s*([\\'\"]?)([^\\'\">]*)\\1(.*?)>\/isu'<\/span>, $body<\/span>, $matches<\/span>);\r\n    $img_array<\/span> = $matches<\/span>[0<\/span>];\r\n    $src_array<\/span> = $matches<\/span>[2<\/span>];\r\n    foreach<\/span> ($img_array<\/span> as<\/span> $key<\/span> => $value<\/span>)\r\n    {\r\n        $body<\/span> = str_replace<\/span>($value<\/span>, \"<a href='{$src_array[$key]}<\/span>' target='_blank'>\"<\/span>.$value<\/span>.\"<\/a>\"<\/span>, $body<\/span>);\r\n    }\r\n    return<\/span> $body<\/span>;\r\n}<\/code><\/pre>\n

2\u3001\u628a\u5185\u5bb9\u6a21\u677f\u91cc\u7684\u8c03\u7528\u5185\u5bb9\u7684\u6807\u7b7e<\/p>\n

{dede:field.body\/}<\/code><\/pre>\n

\u6539\u6210<\/p>\n

{dede:field.body function=\"setBodyimg(@me)\"\/}\r\n<\/code><\/pre>\n

\u5b8c\u6210<\/p>\n","protected":false},"excerpt":{"rendered":"

\u7ec7\u68a6(DEDECMS)\u6587\u6863\u5185\u5bb9\u56fe\u7247\u81ea\u52a8\u6dfb\u52a0a\u94fe\u63a5\u5e76\u5728\u65b0\u7a97\u53e3\u6253\u5f00\u56fe\u7247 \u4fee\u6539\u4e4b\u524d \u4fee\u6539\u4e4b\u540e \u65b9\u6cd5\u4e00\uff1ajquery […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[1735,180],"class_list":["post-5517","post","type-post","status-publish","format-standard","hentry","category-web","tag-a","tag-180"],"_links":{"self":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts\/5517","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/comments?post=5517"}],"version-history":[{"count":0,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts\/5517\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/media?parent=5517"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/categories?post=5517"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/tags?post=5517"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}