钩子名称upload_file
定义方法\Phpcmf\Hooks::trigger('upload_file', [
'type' => $type,
'data' => $data,
'file_path' => $file_path,
'attachment' => $attachment
]);
参数说明Array
(
'type' => $type, // 存储类型,content表示内容存储,upload表示上传存储
'data' => $data, // 当content时是内容详情,当upload时是上传的临时文件路径
'file_path' => $file_path, // 存储本地文件路径,
'attachment' => $attachment // 附件存储策略数据
)
#以实际输出的参数为准
用法举例
/config/hooks.php\Phpcmf\Hooks::on('upload_file', function($config) {
... 你的程序段
$config['file_path']就是本附件的本地存储地址,你可以在这里进行对附件优化,比如图片处理等等
});
本文地址:https://www.xunruicms.com/doc/978.html