public function getCategoryItemSale() { $arrs = parent::getCategoryItemSale(); $this->_category_item_sale = array(); foreach ($arrs as $k => $v) { $this->_category_item_sale[$k] = str_replace(array(" ", "\r\n"), "", $v); } return $this->_category_item_sale; }
public function getCategoryItemSale() { $nodes = parent::getCategoryItemSale(); $this->_category_item_sale = array(); foreach ($nodes as $k => $str) { $p = '/(\\d+)/'; preg_match($p, $str, $out); $num = intval($out[0]); $c = ''; if (strpos($str, '天')) { $c = 'day'; } else { if (strpos($str, '时')) { $c = 'hour'; } else { if (strpos($str, '月')) { $c = 'month'; } } } $this->_category_item_sale[$k] = date('Y-m-d H:i:s', strtotime("-" . $num . $c)); } return $this->_category_item_sale; }