Просмотр исходного кода

wesmiler 报恩寺项目提交

wesmiler 4 лет назад
Родитель
Сommit
e92c73a70d
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      app/Http/Controllers/Api/v1/IndexController.php

+ 4 - 2
app/Http/Controllers/Api/v1/IndexController.php

@@ -181,10 +181,12 @@ class IndexController extends BaseController
         $content1 = file_get_contents($apiUrl.'/laohuangli/');
         $temp1 = substr($content1,strpos($content1, '<div class="goodcalendar4">'));
         $temp1 = substr($temp1,0, strpos($temp1, '</div>'));
-        preg_match("/<td>(.*)<\/td>/", $temp1, $yi);
+        preg_match("/<\/td><td>(.*)<\/td><td>/", $temp1, $yi);
+        $yi = isset($yi[1])? $yi[1] : '';
         preg_match("/<td colspan=\"3\">(.*)<\/td>/", $temp1, $ji);
+        $ji = isset($ji[1])? $ji[1] : '';
 
-        return message(MESSAGE_OK, true, ['content'=> $content, 'result'=> $temp,'yj'=> $temp1,'yi'=> $yi,'ji'=> $ji]);
+        return message(MESSAGE_OK, true, ['content'=> $content, 'result'=> $temp,'yj'=> $temp1,'yi'=> $yi,'ji'=> isset()]);
 
     }
 }