Selaa lähdekoodia

修复 select 生成在 php8 环境中的报错

F4nniu 1 vuosi sitten
vanhempi
commit
7fe625cf5b
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 2 2
      application/admin/common.php

+ 2 - 2
application/admin/common.php

@@ -18,8 +18,8 @@ if (!function_exists('build_select')) {
      */
     function build_select($name, $options, $selected = [], $attr = [])
     {
-        $options = is_array($options) ? $options : explode(',', $options);
-        $selected = is_array($selected) ? $selected : explode(',', $selected);
+        $options = is_array($options) ? $options : explode(',', $options ?? '');
+        $selected = is_array($selected) ? $selected : explode(',', $selected ?? '');
         return Form::select($name, $options, $selected, $attr);
     }
 }