|
@@ -63,8 +63,13 @@ class lyhDemo extends Command |
|
@@ -63,8 +63,13 @@ class lyhDemo extends Command |
|
63
|
//查看当前是否包含句号。
|
63
|
//查看当前是否包含句号。
|
|
64
|
$result = $this->hasAnyPeriod($item['seo_description']);
|
64
|
$result = $this->hasAnyPeriod($item['seo_description']);
|
|
65
|
if($result === false){
|
65
|
if($result === false){
|
|
|
|
66
|
+ $res = $this->hasPeriod($item['seo_description']);
|
|
|
|
67
|
+ if($res === false){
|
|
66
|
$text = $this->trimToLastFullWord($item['seo_description']);
|
68
|
$text = $this->trimToLastFullWord($item['seo_description']);
|
|
67
|
}else{
|
69
|
}else{
|
|
|
|
70
|
+ $text = substr($item['seo_description'], 0, strrpos($item['seo_description'], ',')).'.';
|
|
|
|
71
|
+ }
|
|
|
|
72
|
+ }else{
|
|
68
|
$arr = explode('.',$item['seo_description']);
|
73
|
$arr = explode('.',$item['seo_description']);
|
|
69
|
$text = $arr[0].'.';
|
74
|
$text = $arr[0].'.';
|
|
70
|
}
|
75
|
}
|
|
@@ -91,4 +96,7 @@ class lyhDemo extends Command |
|
@@ -91,4 +96,7 @@ class lyhDemo extends Command |
|
91
|
public function hasAnyPeriod($text) {
|
96
|
public function hasAnyPeriod($text) {
|
|
92
|
return strpos($text, '.') !== false || mb_strpos($text, '。') !== false;
|
97
|
return strpos($text, '.') !== false || mb_strpos($text, '。') !== false;
|
|
93
|
}
|
98
|
}
|
|
|
|
99
|
+ public function hasPeriod($text) {
|
|
|
|
100
|
+ return strpos($text, ',') !== false;
|
|
|
|
101
|
+ }
|
|
94
|
} |
102
|
} |