rezident/yii2-attach-file

这个yii2扩展允许您将不同的上传文件附加到模型上,并在不同的视图中表示这些文件

安装: 32

依赖: 0

建议: 0

安全性: 0

星标: 0

关注者: 0

分支: 0

开放性问题: 0

类型:yii2-extension

0.9.14 2017-04-15 17:03 UTC

This package is auto-updated.

Last update: 2024-08-28 23:37:55 UTC


README

这个yii2扩展允许您将不同的上传文件附加到模型上。该扩展尚未完成!它不起作用!版本0.9适用于在实际项目中测试。

配置

要使用此扩展,只需在您的应用程序配置中添加以下代码

return [
    //.....
    'modules' => [
        //.....
        'attach_file' => [
            'class' => rezident\attachfile\AttachFileModule::class,
            'originalsPath' => '@app/files/originals',
            'viewsPath' => '@app/files/views',
            'webPath' => '@app/files/views'
        ]
    ]
];

用法

将行为添加到模型

要将行为添加到模型,您必须

public function behaviors()
{
    return [
        'specified' => [
            'class' => rezident\attachfile\behaviors\AttachFileBehavior::class,
            'modelKey' => 'specified' // If it is not specified, will be used the short name of the model class
        ]
    ];
}