|
...
|
...
|
@@ -63,7 +63,12 @@ class lyhDemo extends Command |
|
|
|
//查看当前是否包含句号。
|
|
|
|
$result = $this->hasAnyPeriod($item['seo_description']);
|
|
|
|
if($result === false){
|
|
|
|
$text = $this->trimToLastFullWord($item['seo_description']);
|
|
|
|
$res = $this->hasPeriod($item['seo_description']);
|
|
|
|
if($res === false){
|
|
|
|
$text = $this->trimToLastFullWord($item['seo_description']);
|
|
|
|
}else{
|
|
|
|
$text = substr($item['seo_description'], 0, strrpos($item['seo_description'], ',')).'.';
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$arr = explode('.',$item['seo_description']);
|
|
|
|
$text = $arr[0].'.';
|
|
...
|
...
|
@@ -91,4 +96,7 @@ class lyhDemo extends Command |
|
|
|
public function hasAnyPeriod($text) {
|
|
|
|
return strpos($text, '.') !== false || mb_strpos($text, '。') !== false;
|
|
|
|
}
|
|
|
|
public function hasPeriod($text) {
|
|
|
|
return strpos($text, ',') !== false;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|