| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- namespace App\Module\File;
- use Illuminate\Support\Facades\Storage;
- class File
- {
- public static function getPath($name,$disk=null)
- {
- $src = Storage::disk($disk)->get($name);
- return $src;
- }
- /**
- * 获取 真实储存地址
- *
- * @param $path
- * @return string
- */
- static public function getVisibility($path)
- {
- $disk = config('admin.upload.disk');
- if (config("filesystems.disks.{$disk}")) {
- $src = Storage::disk($disk)->getVisibility($path);
- }
- return $src;
- }
- /**
- * 获取
- * @param $path
- * @return string
- */
- static public function prefixPath($path)
- {
- $disk = config('admin.upload.disk');
- if (config("filesystems.disks.{$disk}")) {
- /**
- * @var \Illuminate\Filesystem\FilesystemAdapter $storage
- */
- $src= Storage::disk($disk)->path($path);
- }
- return $src;
- }
- static public function fileExists($path)
- {
- $disk = config('admin.upload.disk');
- if (config("filesystems.disks.{$disk}")) {
- /**
- * @var \Illuminate\Filesystem\FilesystemAdapter $storage
- */
- $src= Storage::disk($disk)->fileExists($path);
- }
- return $src;
- }
- }
|