我正在使用elFinder package。请帮我覆盖Laravel中的sanitizeFileName
方法
vendor\studio-42\elfinder\php\plugins\Sanitizer\plugin.php
以下是方法:
private function sanitizeFileName($filename, $opts, $allows = array())
{
$targets = $allows? array_diff($opts['targets'], $allows) : $opts['targets'];
return str_replace($targets, $opts['replace'], $filename);
}
答案 0 :(得分:0)
您可以通过继承该类来覆盖它,然后在您的类中编写确切的方法。像这样:
class MyClass extends Plugin{
private function sanitizeFileName($filename, $opts, $allows = array()){
// your code here...
}
}
如果您对可见性有疑问,请改用protected
/ public
。
更新: 扩展课程
What is the proper way to extend a class in another file?