gevman / yii2-file-manager
为 Yii2 的文件管理模块
2.3.2
2018-07-20 19:58 UTC
Requires
- php: >=5.4
- yiisoft/yii2-imagine: ^2.1
README
将此添加到 web.php
'bootstrap' => [/* other, */'file-manager'/*, other*/], // and 'modules' => [ /* other, */ 'file-manager' => [ 'class' => Gevman\FileManager\Module::class, 'returnFullPath' => false, 'uploadFolder' => '/uploads', 'allowedExtensions' => [ 'images' => ['jpg', 'png', 'gif'], ], 'cacheComponent' => 'cache', 'beforeAction' => function() { if (Yii::$app->user->isGuest) { throw new \yii\web\ForbiddenHttpException(Yii::t('yii', 'You are not allowed to perform this action.')); } } ], /*, other* ],
还有一个用于自动化文件缩略图索引的命令行命令
在控制台配置中设置 @webroot 别名,首先添加此到配置文件后
'bootstrap' => [/* other, */'file-manager'/*, other*/], // and 'modules' => [ /* other, */ 'file-manager' => [ 'class' => Gevman\FileManager\Module::class, 'returnFullPath' => true, 'uploadFolder' => '/uploads', 'cacheComponent' => 'cache', ], /*, other* ], after run `php yii file-manager/index-files`