{"id":1086,"date":"2019-09-21T16:34:43","date_gmt":"2019-09-21T08:34:43","guid":{"rendered":"http:\/\/www.baishitou.cn\/?p=1086"},"modified":"2019-09-30T20:50:28","modified_gmt":"2019-09-30T12:50:28","slug":"dedecms%e6%96%87%e7%ab%a0%e4%b8%ad%e7%9a%84%e5%9b%be%e7%89%87%e8%87%aa%e5%8a%a8%e6%b7%bb%e5%8a%a0alt%e5%b1%9e%e6%80%a7","status":"publish","type":"post","link":"https:\/\/www.baishitou.cn\/1086.html","title":{"rendered":"\u7ec7\u68a6DEDEcms\u6587\u7ae0\u5185\u5bb9\u4e2d\u7684\u56fe\u7247\u81ea\u52a8\u6dfb\u52a0ALT\u548ctitle\u5c5e\u6027\u4e3a\u6587\u7ae0\u6807\u9898"},"content":{"rendered":"
\u6253\u5f00Include\/\u00a0arc.archives.class.php<\/p>\n
\u67e5\u627e\uff1a<\/p>\n
@SetSysEnv($this->Fields['typeid'],$this->Fields['typename'],$this->Fields['id'],$this->Fields['title'],'archives');<\/code><\/pre>\n\u5728\u4e0a\u9762\u4ee3\u7801\u540e\u9762\u6dfb\u52a0\uff1a<\/p>\n
\/\/\u66ff\u6362\u56fe\u7247Alt\u548ctitle\u4e3a\u6587\u6863\u6807\u9898\r\n$this->Fields['body'] = str_ireplace(array('altalt=\"\"','alt=\\'\\''),'',$this->Fields['body']);\r\n$this->Fields['body'] = preg_replace(\"@ [\\s]{0,}alt[\\s]{0,}=[\\\"'\\s]{0,}[\\s\\S]{0,}[\\\"'\\s] @isU\",\" \",$this->Fields['body']);\r\n$this->Fields['body'] = str_ireplace(\"<img \" ,\"<img alt=\\\"\".$this->Fields['title'].\"\\\" title=\\\"\".$this->Fields['title'].\"\\\" \",$this->Fields['body']);\r\n$this->Fields['imgurls'] = str_ireplace(array('altalt=\"\"','alt=\\'\\''),'',$this->Fields['imgurls']);\r\n$this->Fields['imgurls'] = preg_replace(\"@ [\\s]{0,}alt[\\s]{0,}=[\\\"'\\s]{0,}[\\s\\S]{0,}[\\\"'\\s] @isU\",\" \",$this->Fields['imgurls']);\r\n$this->Fields['imgurls'] = str_ireplace(\"<img \" ,\"<img alt=\\\"\".$this->Fields['title'].\"\\\" \",$this->Fields['imgurls']);<\/pre>\n\u4e0a\u9762\u662f\u4fee\u6539\u9ed8\u8ba4\u7684\u6a21\u677f\u6807\u7b7e\uff1a{dede:field.body\/} \uff0c\u5982\u679c\u662f\u5176\u5b83\u5b57\u6bb5\uff0c\u53ef\u4ee5\u4fee\u6539$this->Fields['body'] \u4e3a\u5176\u5b83\u7684\u5b57\u6bb5\u540d\u3002<\/p>\n
\n\u6548\u7387\u8bf4\u660e\uff1a\u4f7f\u7528\u4e86\u6b63\u5219\u5904\u7406\uff0c\u4f1a\u964d\u4f4e\u4e00\u4e9b\u751f\u6210\u901f\u5ea6\uff0c\u5982\u679c\u6570\u636e\u91cf\u5c0f\uff0c\u5219\u53ef\u4ee5\u5ffd\u7565\u3002<\/p>\n
DEDEcms\u6587\u7ae0\u4e2d\u7684\u56fe\u7247\u81ea\u52a8\u6dfb\u52a0ALT\u548ctitle\u65b9\u6cd5\u4e8c<\/h2>\n<\/div>\n\n\u4e0d\u4fee\u6539\u7cfb\u7edf\u6838\u5fc3\u6587\u4ef6\uff0c\u53ea\u7528\u5728\u6a21\u677f\u91cc\u9762\u8c03\u7528\u5c31\u884c\u4e86\u3002\u628a\u5185\u5bb9\u9875\u7684{dede<\/span>:field.body\/}\u8c03\u7528\u6807\u7b7e\u66ff\u6362\u4e3a<\/p>\n{dede:field.body runphp=yes}\r\nglobal $dsql,$id,$aid;\r\n$myid = isset($id) ? $id : $aid;\r\n$row = $dsql->GetOne(\"SELECT title FROM `#@__archives` WHERE id=$myid\");\r\n$title = $row['title'];\r\n$str = @me;\r\n$search = '\/(<img.*?)alt=([\"\\'])?.*?(?(2)\\2|\\s)([^>]+>)\/is';\r\n$search1 = '\/(<img.*?)title=([\"\\'])?.*?(?(2)\\2|\\s)([^>]+>)\/is';\r\n$content = preg_replace($search,'$1$3',$str);\r\n$content = preg_replace($search1,'$1$3',$content);\r\n@me = str_replace('<img', \"<img alt='{$title}' title='{$title}'\", $content);\r\n{\/dede:field.body}<\/code><\/pre>\n <\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"
DEDEcms\u6587\u7ae0\u4e2d\u7684\u56fe\u7247\u81ea\u52a8\u6dfb\u52a0ALT\u5c5e\u6027\u65b9\u6cd5\u4e00 \u6253\u5f00Include\/\u00a0arc.archives.class […]<\/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":[302,43,745,378,746,180],"class_list":["post-1086","post","type-post","status-publish","format-standard","hentry","category-web","tag-alt","tag-dedecms","tag-title","tag-378","tag-746","tag-180"],"_links":{"self":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts\/1086","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=1086"}],"version-history":[{"count":0,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts\/1086\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/media?parent=1086"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/categories?post=1086"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/tags?post=1086"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}