{"id":2067,"date":"2018-11-21T16:17:22","date_gmt":"2018-11-21T08:17:22","guid":{"rendered":"https:\/\/www.baishitou.cn\/?p=2067"},"modified":"2018-11-21T16:17:22","modified_gmt":"2018-11-21T08:17:22","slug":"%e7%bb%87%e6%a2%a6dedecms%e4%bf%ae%e6%94%b9%e6%96%87%e7%ab%a0%e6%91%98%e8%a6%81%e5%ad%97%e6%95%b0%e7%9a%84%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.baishitou.cn\/2067.html","title":{"rendered":"\u7ec7\u68a6DEDECMS\u4fee\u6539\u6587\u7ae0\u6458\u8981\u5b57\u6570\u7684\u65b9\u6cd5"},"content":{"rendered":"

\u5728Dedecms\u7cfb\u7edf\u4e2d\uff0c\u6587\u7ae0\u6458\u8981\uff08\u53ef\u4ee5\u901a\u8fc7infolen\u6216description\u76f8\u5173\u6807\u7b7e\u8c03\u7528\uff09\u88ab\u8bbe\u7f6e\u4e86\u5b57\u6570\u4e0a\u9650\u4e3a250\u5b57\u7b26\uff0c\u8bbe\u7f6e\u4e0a\u9650\u7684\u4e3b\u8981\u76ee\u7684\u662f\u51cf\u5c11\u6570\u636e\u5e93\u7684\u5197\u4f59\uff0c\u4fdd\u8bc1\u7f51\u7ad9\u826f\u597d\u7684\u6027\u80fd\u3002\u56e0\u6b64\uff0c\u5982\u679c\u5bf9\u7b80\u4ecb\u5185\u5bb9\u4e0d\u8bbe\u7f6e\u4e0a\u9650\u663e\u7136\u4e0d\u5408\u7406\uff0c\u4f46\u662f\u5982\u679c\u53ef\u4ee5\u81ea\u7531\u63a7\u5236\u8fd9\u4e00\u4e0a\u9650\uff0c\u90a3\u4e48\u5c06\u5bf9\u7f51\u9875\u5185\u5bb9\u5e03\u5c40\u5e26\u6765\u79ef\u6781\u4f5c\u7528\u3002\u5728\u7f51\u9875\u8bbe\u8ba1\u8fc7\u7a0b\u4e2d\uff0c\u5f80\u5f80\u9700\u8981\u5728\u9891\u9053\u5217\u8868\u9875\u9762\u8c03\u7528\u5230\u6587\u7ae0\u6458\u8981\uff0c\u5982\u679c\u53ef\u4ee5\u6709\u6548\u63a7\u5236\u6587\u7ae0\u6458\u8981\u7684\u5b57\u6570\uff0c\u90a3\u4e48\u5c31\u53ef\u4ee5\u4f7f\u5f97\u9875\u9762\u5e03\u5c40\u5f88\u7075\u6d3b\u3002<\/p>\n

\u5728Dedecms\u4e2d\uff0c\u5728\u5217\u8868\u9875\u8c03\u7528\u6587\u7ae0\u6458\u8981\u7684\u65b9\u6cd5\u4e3b\u8981\u6709\uff1a<\/p>\n

\n
1\u3001[field:info \/]\r\n2\u3001[field:description \/]\r\n3\u3001[field:info function=\"cn_substr(@me,\u5b57\u7b26\u6570)\"\/]\r\n4\u3001[field:description function=\"cn_substr(@me,\u5b57\u7b26\u6570)\"\/]<\/pre>\n<\/div>\n

\u7b2c1\u30012\u79cd\u65b9\u6cd5\u662f\u76f4\u63a5\u8c03\u7528\u6587\u7ae0\u6458\u8981\uff0c\u5728\u8c03\u7528\u7684\u5b57\u6570\u95ee\u9898\u4e0a\uff0c\u5f53\u4f7f\u7528[field:info \/]\u65f6\uff0c\u53ef\u4ee5\u5728{dede:arclist infolen=' ' }{\/dede:arclist}\u4e2d\uff0c\u8bbe\u7f6e\u8c03\u7528\u6458\u8981\u7684\u5b57\u7b26\u6570\uff08\u6700\u9ad8\u53ef\u8bbe\u7f6e\u4e3a\u7cfb\u7edf\u8bbe\u7f6e\u7684250\uff09\uff1b\u5982\u679c\u4f7f\u7528[field:description \/]\uff0c\u5219\u76f4\u63a5\u4f7f\u7528\u540e\u53f0\u8bbe\u7f6e\u7684\u6458\u8981\u5b57\u7b26\u4e0a\u9650\u3002\u663e\u7136\uff0c\u8fd9\u4e24\u79cd\u65b9\u5f0f\u90fd\u5f88\u88ab\u52a8\uff0c\u7075\u6d3b\u6027\u592a\u5dee\u3002<\/p>\n

\u7b2c3\u30014\u79cd\u65b9\u6cd5\u901a\u8fc7function\u51fd\u6570\u5b9e\u73b0\u4e86\u5bf9\u6587\u7ae0\u6458\u8981\u663e\u793a\u5b57\u7b26\u7684\u7075\u6d3b\u8c03\u6574\u3002\u5f53\u7136\uff0c\u5728\u6ca1\u6709\u4fee\u6539\u6587\u7ae0\u6458\u8981\u5185\u5bb9\u5b57\u7b26\u4e0a\u9650\u65f6\uff0c\u8fd94\u4e2a\u65b9\u6cd5\u7684\u5dee\u5f02\u5e76\u4e0d\u5927\u3002\u4f46\u662f\uff0c\u4e0b\u9762\u6211\u4eec\u6765\u8bf4\u5982\u4f55\u4fee\u6539\u8fd9\u4e00\u4e0a\u9650\u503c\uff0c\u5c31\u53ef\u4ee5\u4f53\u73b0\u51fa[field:description function=\"cn_substr(@me,\u5b57\u7b26\u6570)\"\/]\u8fd9\u4e00\u65b9\u5f0f\u7684\u91cd\u8981\u6027\u3002<\/p>\n

\u5728Dedecms\u4e2d\uff0c\u4e0e\u6587\u7ae0\u6458\u8981\u76f8\u5173\u7684php\u6587\u4ef6\u4e3b\u8981\u6709\uff1a<\/p>\n

\n
\/dede\/archives_add.php\r\n\/dede\/archives_edit.php\r\n\/dede\/article_add.php\r\n\/dede\/article_edit.php\r\n\/dede\/article_description_main.php<\/pre>\n<\/div>\n

\u5728add\u9875\u9762\uff0c\u6709\u4e00\u53e5\u8bdd\u662f\uff1a\u201c$description = cn_substrR($description,$cfg_auot_description); \u201d\uff0c\u8fd9\u53e5\u8bdd\u5b9e\u73b0\u4e86[field:description function=\"cn_substr(@me,\u5b57\u7b26\u6570)\"\/]\u8fd9\u4e00\u529f\u80fd\u3002\u56e0\u4e3a\u8fd9\u4e00\u8bed\u53e5\u786e\u5b9e\u6709\u5229\u4e8e\u9875\u9762\u5e03\u5c40\uff0c\u56e0\u6b64\u6211\u4eec\u5728\u5b9e\u9a8c\u4e2d\u6ca1\u6709\u4fee\u6539\u3002<\/p>\n

\u5728edit\u9875\u9762\uff0c\u6709\u4e00\u53e5\u8bdd\u662f\uff1a\u201c$description = cn_substrR($description,250); \u201d\uff0c\u8fd9\u53e5\u8bdd\u4e2d\u51fa\u73b0\u4e86\u4e00\u4e2a\u719f\u6089\u7684\u5b57\u7b26\u6570\u201c250\u201d\uff0c\u8fd9\u5c31\u662f\u7cfb\u7edf\u8bbe\u7f6e\u7684\u6587\u7ae0\u6458\u8981\u5b57\u7b26\u6570\u7684\u4e0a\u9650\u503c\u3002 \u5982\u679c\u662fgbk\u7f16\u7801\u5219\u663e\u793a\u51fa\u6765\u7684\u5c31\u662f125\u4e2a\u5b57\u3002\u5982\u679c\u662futf-8\u7f16\u7801\u5219\u662f81\u4e2a\u5b57\u3002\u663e\u7136\uff0c\u6211\u4eec\u8981\u7a81\u7834\u6587\u7ae0\u6458\u8981\u5b57\u7b26\u6570\u4e0a\u9650\uff0c\u80af\u5b9a\u5f97\u62ff\u5b83\u5f00\u5200\u4e86\u3002\u662f\u7684\uff0c\u8fd9\u91cc\u4fee\u6539\u201c250\u201d\u4e3a\u5176\u4ed6\u503c\u5373\u53ef\uff0c\u4f8b\u5982\u201c500\u201d\u3002\u8fd9\u91cc\u4e0d\u63a8\u8350\u8bbe\u7f6e\u5f97\u8fc7\u9ad8\uff0c\u4e00\u4e2a\u662f\u5728\u5217\u8868\u9875\u6ca1\u5fc5\u8981\u5c55\u793a\u592a\u591a\u5185\u5bb9\uff08\u5c55\u793a\u592a\u591a\u5185\u5bb9\u4e0d\u5982\u76f4\u63a5\u7528body\u4e86\uff09\uff0c\u53e6\u4e00\u4e2a\u662f\u907f\u514d\u6570\u636e\u5e93\u4ea7\u751f\u5197\u4f59\u3002<\/p>\n

\u5b8c\u6210\u4e0a\u9762\u7684\u4fee\u6539\u8fd8\u4e0d\u591f\uff0c\u8fd8\u9700\u8981\u4fee\u6539article_description_main.php<\/p>\n

\u5728article_description_main.php\u9875\u9762\uff0c\u627e\u5230\u201cif($dsize>250) $dsize = 250;\u201d\u8bed\u53e5\uff0c\u8fd9\u91cc\u9650\u5236\u4e86\u5728\u540e\u53f0\u81ea\u52a8\u83b7\u53d6\u6458\u8981\u7684\u5b57\u7b26\u6570\u3002\u628a\u8fd9\u91cc\u7684\u201c250\u201d\u4fee\u6539\u4e3a\u201c500\u201d\u5373\u53ef\uff0c\u4e5f\u5c31\u662f\u548c\u4e4b\u524d\u4fee\u6539\u7684\u5b57\u7b26\u6570\u4e00\u81f4\u5373\u53ef\u3002\uff08\u5982\u679c\u4f60\u786e\u8ba4\u4f60\u7684\u6bcf\u4e00\u6761\u6587\u7ae0\u90fd\u662f\u624b\u52a8\u6dfb\u52a0\uff0c\u624b\u52a8\u5b8c\u6210\u6458\u8981\u83b7\u53d6\u5c31\u4e0d\u9700\u8981\u4fee\u6539\u8fd9\u4e2a\u6587\u4ef6\u4e86\u3002\u81ea\u52a8\u6458\u8981\u83b7\u53d6\u4e3b\u8981\u8fd8\u662f\u7ed9\u5927\u91cf\u6587\u7ae0\u548c\u91c7\u96c6\u51c6\u5907\u7684\u3002\uff09<\/p>\n

\u6700\u540e\uff0c\u767b\u5f55\u540e\u53f0\uff0c\u5728\u7cfb\u7edf\uff0d\u7cfb\u7edf\u57fa\u672c\u53c2\u6570\uff0d\u5176\u5b83\u9009\u9879\u4e2d\uff0c\u81ea\u52a8\u6458\u8981\u957f\u5ea6\uff0c\u6539\u6210500\u5373\u53ef\uff0c\u4e5f\u5c31\u662f\u548c\u4e4b\u524d\u4fee\u6539\u7684\u5b57\u7b26\u6570\u4e00\u81f4\u5373\u53ef\u3002<\/p>\n

\u5b8c\u6210\u4e0a\u8ff0\u4fee\u6539\u540e\uff0c\u6211\u4eec\u518d\u5230\u9891\u9053\u5217\u8868\u9875\uff0c\u901a\u8fc7\u6807\u7b7e\u8c03\u7528\u5373\u53ef\uff0c\u793a\u4f8b\u6807\u7b7e\u5982\u4e0b\uff1a<\/p>\n

\n
{dede:list typeid='' row='5' titlelen='100' orderby='new' pagesize='5'}\r\n<h3><a href='[field:arcurl\/]'>[field:title\/]<\/a><\/h3>\r\n<p>[field:description function='cn_substr(@me,500)'\/]...<\/p>\r\n{\/dede:list}<\/pre>\n<\/div>\n

\u901a\u8fc7\u4ee5\u4e0a\u65b9\u5f0f\uff0c\u6211\u4eec\u5c31\u5b9e\u73b0\u4e86\u8c03\u7528\u7684\u6587\u7ae0\u6458\u8981\u5b57\u7b26\u4e3a500\u5b57\u7b26\uff0c\u5b8c\u5168\u7a81\u7834\u4e86\u6587\u7ae0\u6458\u8981250\u5b57\u7b26\u7684\u7cfb\u7edf\u9650\u5236\uff0c\u4e3a\u7f51\u9875\u5e03\u5c40\u63d0\u4f9b\u4e86\u66f4\u52a0\u5e7f\u9614\u7684\u7a7a\u95f4\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u5728Dedecms\u7cfb\u7edf\u4e2d\uff0c\u6587\u7ae0\u6458\u8981\uff08\u53ef\u4ee5\u901a\u8fc7infolen\u6216description\u76f8\u5173\u6807\u7b7e\u8c03\u7528\uff09\u88ab\u8bbe\u7f6e\u4e86\u5b57\u6570\u4e0a\u9650 […]<\/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,286,180],"class_list":["post-2067","post","type-post","status-publish","format-standard","hentry","category-web","tag-dedecms","tag-286","tag-180"],"_links":{"self":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts\/2067","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=2067"}],"version-history":[{"count":0,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts\/2067\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/media?parent=2067"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/categories?post=2067"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/tags?post=2067"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}