作者 lyh

gx

@@ -193,8 +193,11 @@ class BlogLogic extends BaseLogic @@ -193,8 +193,11 @@ class BlogLogic extends BaseLogic
193 * @time :2023/10/20 9:02 193 * @time :2023/10/20 9:02
194 */ 194 */
195 public function getCategory($category){ 195 public function getCategory($category){
  196 + if(empty($category)){
  197 + return '';
  198 + }
196 $str = implode(',',$category); 199 $str = implode(',',$category);
197 - return !empty(trim(trim($str,','),',')) ? ','.$str.',' : ''; 200 + return !empty(trim(trim($str,','),',')) ? ','.trim(trim($str,','),',').',' : '';
198 } 201 }
199 202
200 /** 203 /**
@@ -213,7 +213,7 @@ class NewsLogic extends BaseLogic @@ -213,7 +213,7 @@ class NewsLogic extends BaseLogic
213 */ 213 */
214 public function getCategory($category){ 214 public function getCategory($category){
215 $str = implode(',',$category); 215 $str = implode(',',$category);
216 - return !empty(trim(trim($str,','),',')) ? ','.$str.',' : ''; 216 + return !empty(trim(trim($str,','),',')) ? ','.trim(trim($str,','),',').',' : '';
217 } 217 }
218 218
219 /** 219 /**