diff --git a/functions.php b/functions.php index d5d0413..b633d78 100644 --- a/functions.php +++ b/functions.php @@ -174,11 +174,12 @@ function allwords() { function show_first_image($content) { preg_match_all('//i', $content, $matches); // 检查是否找到了图片 - if(isset($matches[1][0])){ + if(count($matches) > 0 && count($matches[0]) > 0 ){ return $matches[1][0]; - } + } else { return false; // 没有找到图片,返回 false } +} //开始增加某些奇怪的东西 // 获取月份 function getMonth() {