{"id":2090,"date":"2018-11-24T23:58:23","date_gmt":"2018-11-24T15:58:23","guid":{"rendered":"https:\/\/www.baishitou.cn\/?p=2090"},"modified":"2018-11-24T23:58:23","modified_gmt":"2018-11-24T15:58:23","slug":"%e7%bb%87%e6%a2%a6dedecms%e6%8f%90%e5%8f%96%e6%96%87%e7%ab%a0%e5%86%85%e5%ae%b9%e7%ac%ac%e4%b8%80%e5%bc%a0%e5%9b%be%e7%89%87%e6%88%96%e8%80%85%e5%a4%9a%e5%bc%a0%e5%9b%be%e7%89%87%e8%be%93%e5%87%ba","status":"publish","type":"post","link":"https:\/\/www.baishitou.cn\/2090.html","title":{"rendered":"\u7ec7\u68a6DEDECMS\u63d0\u53d6\u6587\u7ae0\u5185\u5bb9\u7b2c\u4e00\u5f20\u56fe\u7247\u6216\u8005\u591a\u5f20\u56fe\u7247\u8f93\u51fa"},"content":{"rendered":"

\u7ec7\u68a6DEDECMS\u63d0\u53d6\u6587\u7ae0\u5185\u5bb9\u7b2c\u4e00\u5f20\u56fe\u7247<\/h2>\n

\u6253\u5f00 \/include\/extend.func.php \u5728\u6700\u4e0b\u9762\u52a0\u5165\u4e0b\u9762\u4ee3\u7801<\/p>\n

\/**\r\n *  \u6587\u7ae0\u5185\u5bb9\u63d0\u53d6\u7b2c\u4e00\u5f20\u56fe\u7247\r\n *\r\n * @access    public\r\n * @param     string  $id\t\t\u6587\u6863id\r\n * @param     string  $addField\t\u5b57\u6bb5\u540d\r\n * @return    string\r\n *\/\r\nif(!function_exists('getBodyonepic'))\r\n{\r\n\tfunction getBodyonepic($id, $addField='body')\r\n\t{\r\n\t\tglobal $dsql;\r\n\t\t$row = $dsql->GetOne(\"SELECT a.litpic,c.addtable FROM #@__archives AS a LEFT JOIN #@__channeltype AS c ON a.channel=c.id where a.id='$id'\");\r\n\t\t$addtable = trim($row['addtable']);\r\n\t\tif($row['litpic'] == '-' || $row['litpic'] == '')\r\n\t\t{\r\n\t\t\t$litpic = $GLOBALS['cfg_cmspath'].'\/images\/defaultpic.gif';\r\n\t\t}\r\n\t\t$row = $dsql->GetOne(\"SELECT $addField FROM `$addtable` WHERE aid=$id\");\r\n\t\t$body = $row[\"$addField\"];\r\n\t\tpreg_match_all(\"\/<img([^>]*)\\s*src=('|\\\")([^'\\\"]+)('|\\\")\/\",$body,$matches);\r\n\t\t$imgsrc_arr = array_unique($matches[3]);\r\n\t\t$result = $imgsrc_arr[0] ? $imgsrc_arr[0] : $litpic;\r\n\t\treturn $result;\r\n\t}\r\n}<\/code><\/pre>\n

\u9996\u9875\/\u5217\u8868\u9875\u6807\u7b7e\u8c03\u7528<\/strong><\/p>\n

[field:id function=getBodyonepic(@me)\/]<\/code><\/pre>\n

\u5185\u5bb9\u9875\u6807\u7b7e\u8c03\u7528<\/strong><\/p>\n

{dede:field.id function=getBodyonepic(@me)\/}<\/code><\/pre>\n

\u7ec7\u68a6DEDECMS\u63d0\u53d6\u6587\u7ae0\u5185\u5bb9\u91cc\u7684\u56fe\u7247(\u591a\u5f20)\u81ea\u5b9a\u4e49\u8f93\u51fa<\/h2>\n

\u6253\u5f00 \/include\/extend.func.php \u5728\u6700\u4e0b\u9762\u52a0\u5165\u4e0b\u9762\u4ee3\u7801<\/p>\n

\/**\r\n *  \u6587\u7ae0\u5185\u5bb9\u63d0\u53d6\u56fe\u7247(\u591a\u5f20)\u81ea\u5b9a\u4e49\u8f93\u51fa\r\n *\r\n * @access    public\r\n * @param     string  $string  \t\u6587\u6863\u5185\u5bb9\r\n * @param     string  $num  \t\u8f93\u51fa\u51e0\u5f20\r\n * @return    string\r\n *\/\r\nif(!function_exists('getBodypics'))\r\n{\r\n\tfunction getBodypics($string, $num)\r\n\t{\r\n\t\tpreg_match_all(\"\/<img([^>]*)\\s*src=('|\\\")([^'\\\"]+)('|\\\")\/\",$string,$matches);\r\n\t\t$imgsrc_arr = array_unique($matches[3]);\r\n\t\t$count = count($imgsrc_arr);\r\n\t\t$i = 0;\r\n\t\tforeach($imgsrc_arr as $imgsrc)\r\n\t\t{\r\n\t\t\tif($i == $num) break;\r\n\t\t\t$result .= \"<img src=\\\"$imgsrc\\\"\/>\";\r\n\t\t\t$i++;\r\n\t\t}\r\n\t\treturn $result;\r\n\t}\r\n}<\/code><\/pre>\n

\u9996\u9875\/\u5217\u8868\u9875\u6807\u7b7e\u8c03\u7528<\/strong><\/p>\n

{dede:arclist typeid='' row='' channelid='\u586b\u6a21\u578bid' addfields='body'}\r\n[field:body function=getBodypics(@me,3<\/span>)\/]\r\n{\/dede:arclist}<\/code><\/pre>\n

\u5185\u5bb9\u9875\u6807\u7b7e\u8c03\u7528<\/strong><\/p>\n

{dede:field.body function=getBodypics(@me,3<\/span>)\/}<\/code><\/pre>\n

\u4e0a\u56fe\u4e2d\u76843\u662f\u6307\u83b7\u53d63\u5f20\u56fe\u7247<\/p>\n","protected":false},"excerpt":{"rendered":"

\u7ec7\u68a6DEDECMS\u63d0\u53d6\u6587\u7ae0\u5185\u5bb9\u7b2c\u4e00\u5f20\u56fe\u7247 \u6253\u5f00 \/include\/extend.func.php \u5728\u6700\u4e0b\u9762\u52a0\u5165 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[43,695,444,180],"class_list":["post-2090","post","type-post","status-publish","format-standard","hentry","category-web","tag-dedecms","tag-695","tag-444","tag-180"],"_links":{"self":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts\/2090","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=2090"}],"version-history":[{"count":0,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts\/2090\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/media?parent=2090"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/categories?post=2090"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/tags?post=2090"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}