$opts['roots']['acceptedName']=''; 这一项是用于检查文件和目录名称的正则,默认值在elFinderVolumeDriver.class.php 中的$options属性里面:'acceptedName' => '/^\w[\w\s\.\%\-\(\)\[\]]*$/u',
把它设置为'',对新建或者上传的文件目录名就不检查了。
$connector = new elFinderConnector(new elFinder($opts));
$connector->run();
$opts['roots']['acceptedName']=''; 这一项是用于检查文件和目录名称的正则,默认值在elFinderVolumeDriver.class.php 中的$options属性里面:'acceptedName' => '/^\w[\w\s\.\%\-\(\)\[\]]*$/u',
把它设置为'',对新建或者上传的文件目录名就不检查了。
$connector = new elFinderConnector(new elFinder($opts));
$connector->run();
@ywh1981
你好,想跟你请教个问题:我按照你的方法改了'acceptedName',还是不能支持中文,我是在Yii框架下用的。
1.安装MySQL数据库之后,执行MySQLStorage.sql文件中的内容,新建elfinder_file表
2.修改connector.php文件
'driver' => 'LocalFileSystem'
改为:'driver' => 'MySQL'
3.修改elFinderVolumeMySQL.class.php中的数据库配置,改成自己的数据库名称、密码、数据库名
引入相应语言js文件后修改主页面的js代码,比如是中文则如下:
<script type="text/javascript" charset="utf-8">
$().ready(function() {
var elf = $('#elfinder').elfinder({
url : 'php/connector.php', // connector URL (REQUIRED)
lang: 'zh_CN' // language (OPTIONAL)
}).elfinder('instance');
</script>
elFinder支持中文:
1.<script type="text/javascript" src="/js/i18n/elfinder.ru.js"></script>,将其中的'ru'改为'zh_CN'
2.<script type="text/javascript" charset="utf-8">
$().ready(function() {
var elf = $('#elfinder').elfinder({
url : 'php/connector.php', // connector URL (REQUIRED)
lang: 'zh_CN' // language (OPTIONAL)
}).elfinder('instance');
});
</script>
OK,elFinder可以支持中文了。
按照操作修改成功
elFinder支持中文:
1.<script type="text/javascript" src="/js/i18n/elfinder.ru.js"></script>,将其中的'ru'改为'zh_CN'
2.<script type="text/javascript" charset="utf-8">
$().ready(function() {
var elf = $('#elfinder').elfinder({
url : 'php/connector.php', // connector URL (REQUIRED)
lang: 'zh_CN' // language (OPTIONAL)
}).elfinder('instance');
});
</script>
OK,elFinder可以支持中文了。
按照操作修改成功
windows系统中使用本地文件模式,看不到中文文件夹是因为php这个encode_json方法只支持utf8,elfinder用这个转的时候把name都转成null了。可以在elFinderVolumeLocalFileSystem.class.php这个文件的_basename方法强行转一下就可以看到了...
/**
* Return file name
*
* @param string $path file path
*
@return
string
*
@author
Dmitry (dio) Levashov
**/
protected function _basename($path) {
//return basename($path);
return iconv('gb2312','utf-8',basename($path));
}
虽然不是好办法,勉强用着。php不懂,看的我蛋疼。
windows系统中使用本地文件模式,看不到中文文件夹是因为php这个encode_json方法只支持utf8,elfinder用这个转的时候把name都转成null了。可以在elFinderVolumeLocalFileSystem.class.php这个文件的_basename方法强行转一下就可以看到了...
/**
* Return file name
*
* @param string $path file path
*
@return
string
*
@author
Dmitry (dio) Levashov
**/
protected function _basename($path) {
//return basename($path);
return iconv('gb2312','utf-8',basename($path));
}
虽然不是好办法,勉强用着。php不懂,看的我蛋疼。
这样改了还是不能建中文目录