/" : "
"; $imgHtml .= "
  • {$iconImage}

    {$img['alt']}

    ×
  • "; } } $html = <<
      $imgHtml
    EOF; return $html; } /** * 统一多张图片 * @param $folder * @param $id * @param string $name * @param array $imgs * @param null $callBackFun * @return string */ public function multi($id, $name = "data[image]", $imgs = []) { $url = U("/Base/Photos/index"); $imgHtml = ""; if (!empty($imgs)) { foreach ($imgs as $key => $val) { if (is_string($val)) { $img['url'] = $val; $img['alt'] = ''; } else { $img = $val; } $iconImage = in_array(fileExt($img['url']), ['jpg', 'png', 'gif', 'jpeg', 'bmp']) ? "
    /
    " : "
    "; $imgHtml .= "
  • {$iconImage}

    {$img['alt']}

    ×
  • "; } } $html = <<
      $imgHtml
    EOF; return $html; } /** * 统一上传 * @param $text 按钮文字 * @param $folder 上传文件夹 * @param $id id * @param $option 附加选项 */ public function upload($text, $folder, $id, $option = []) { $folder = urlencode($folder); $trigger = $id . '-trigger'; $modal = $id . '-modal'; $select_btn = $id . '-select-btn'; $upload_btn = $id . '-upload-btn'; $uploader = $id . '_uploader'; $url = isset($option['url']) ? $option['url'] : 'empty'; $upload_url = "/admin/Base/Attachment/webupload?folder=" . $folder; foreach ($option as $key => $val) { $upload_url = $upload_url . '&' . $key . '=' . $val; } $html = <<
    $text
    EOF; return $html; } }