|
@@ -427,3 +427,21 @@ function isChinese($str) { |
|
@@ -427,3 +427,21 @@ function isChinese($str) { |
|
427
|
function isEnglish($str) {
|
427
|
function isEnglish($str) {
|
|
428
|
return preg_match('/^[a-zA-Z]+$/u', $str);
|
428
|
return preg_match('/^[a-zA-Z]+$/u', $str);
|
|
429
|
}
|
429
|
}
|
|
|
|
430
|
+
|
|
|
|
431
|
+/**
|
|
|
|
432
|
+ * @remark :字符串截取
|
|
|
|
433
|
+ * @name :characterTruncation
|
|
|
|
434
|
+ * @author :lyh
|
|
|
|
435
|
+ * @method :post
|
|
|
|
436
|
+ * @time :2023/6/28 17:39
|
|
|
|
437
|
+ */
|
|
|
|
438
|
+function characterTruncation($str,){
|
|
|
|
439
|
+ preg_match('/<main>(.*?)<\/main>/', $str, $matches);
|
|
|
|
440
|
+
|
|
|
|
441
|
+ if (isset($matches[1])) {
|
|
|
|
442
|
+ $result = $matches[1];
|
|
|
|
443
|
+ echo $result;
|
|
|
|
444
|
+ } else {
|
|
|
|
445
|
+ echo "未找到匹配的部分";
|
|
|
|
446
|
+ }
|
|
|
|
447
|
+} |