dede 添加了字段 alt信息无法全部替换解决方案!
$this->Fields['typename'] = $this->TypeLink->TypeInfos['typename'];
@SetSysEnv($this->Fields['typeid'],$this->Fields['typename'],$this->Fields['id'],$this->Fields['title'],'archives');
$this->Fields['body'] = str_ireplace(array('alt=""','alt=\'\''),'',$this->Fields['body']);
$this->Fields['body'] = preg_replace("@ [\s]{0,}alt[\s]{0,}=[\"'\s]{0,}[\s\S]{0,}[\"'\s] @isU"," ",$this->Fields['body']);
$this->Fields['body'] = str_ireplace("<img " ,"<img title=\"".$this->Fields['title']."\" alt=\"".$this->Fields['title']."\" ",$this->Fields['body']);
$this->Fields['shipai'] = str_ireplace(array('alt=""','alt=\'\''),'',$this->Fields['shipai']);
$this->Fields['shipai'] = preg_replace("@ [\s]{0,}alt[\s]{0,}=[\"'\s]{0,}[\s\S]{0,}[\"'\s] @isU"," ",$this->Fields['shipai']);
$this->Fields['shipai'] = str_ireplace("<img " ,"<img title=\"".$this->Fields['title']."\" alt=\"".$this->Fields['title']."\" ",$this->Fields['shipai']);
$this->Fields['information'] = str_ireplace(array('alt=""','alt=\'\''),'',$this->Fields['information']);
$this->Fields['information'] = preg_replace("@ [\s]{0,}alt[\s]{0,}=[\"'\s]{0,}[\s\S]{0,}[\"'\s] @isU"," ",$this->Fields['information']);
$this->Fields['information'] = str_ireplace("<img " ,"<img title=\"".$this->Fields['title']."\" alt=\"".$this->Fields['title']."\" ",$this->Fields['information']);
$this->Fields['strength'] = str_ireplace(array('alt=""','alt=\'\''),'',$this->Fields['strength']);
$this->Fields['strength'] = preg_replace("@ [\s]{0,}alt[\s]{0,}=[\"'\s]{0,}[\s\S]{0,}[\"'\s] @isU"," ",$this->Fields['strength']);
$this->Fields['strength'] = str_ireplace("<img " ,"<img title=\"".$this->Fields['title']."\" alt=\"".$this->Fields['title']."\" ",$this->Fields['strength']);
$this->Fields['why'] = str_ireplace(array('alt=""','alt=\'\''),'',$this->Fields['why']);
$this->Fields['why'] = preg_replace("@ [\s]{0,}alt[\s]{0,}=[\"'\s]{0,}[\s\S]{0,}[\"'\s] @isU"," ",$this->Fields['why']);
$this->Fields['why'] = str_ireplace("<img " ,"<img title=\"".$this->Fields['title']."\" alt=\"".$this->Fields['title']."\" ",$this->Fields['why']);
$this->Fields['case'] = str_ireplace(array('alt=""','alt=\'\''),'',$this->Fields['case']);
$this->Fields['case'] = preg_replace("@ [\s]{0,}alt[\s]{0,}=[\"'\s]{0,}[\s\S]{0,}[\"'\s] @isU"," ",$this->Fields['case']);
$this->Fields['case'] = str_ireplace("<img " ,"<img title=\"".$this->Fields['title']."案例\" alt=\"".$this->Fields['title']."案例\" ",$this->Fields['case']);
网上默认方案都是解决的body字段的问题,添加字段后,添加后的就不生效,
只需要修改Fields['case']中单引号里面的内容即可,替换成你现在新增加的字段名就可以了。
浙公网安备 33010602011771号