thinkphp ckeditor与ckfinder
下载
整合
- 将ckeditor与findeditor下载完成后,放到public目录下,配置ckeditor,下载的时候有demo,可以在线配置的/ckeditor/samples/index.html。
- 将ckfinder的config.php中 authentication验证打开,改成return true;
- 在页面中使用:
<textarea id="content" name="content">
{$info[‘content‘]}
</textarea>
<script type="text/javascript" src="/Public/ckeditor/ckeditor.js"></script>
<script>
CKEDITOR.replace( ‘content‘ ,{
filebrowserBrowseUrl:‘__PUBLIC__/ckfinder/ckfinder.html‘,
filebrowserImageBrowseUrl:‘__PUBLIC__/ckfinder/ckfinder.html?type=Images‘,
filebrowserFlashBrowseUrl: ‘__PUBLIC__/ckfinder/ckfinder.html?type=Flash‘,
filebrowserUploadUrl: ‘__PUBLIC__/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files‘,
filebrowserImageUploadUrl: ‘__PUBLIC__/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images‘,
filebrowserFlashUploadUrl: ‘__PUBLIC__/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash‘}
);
</script>
ckfinder中文乱码
原理: 在上传完成时,将文件保存的名字重命名一下,当然,需要放在它本身的文件名验证之后
解决方案 fileupload.php中 找到文件名检测的最后面,例如
$overwriteOnUpload = $config->get(‘overwriteOnUpload‘);
if (!$overwriteOnUpload && $uploadedFile->autorename()) {
$warningErrorCode = Error::UPLOADED_FILE_RENAMED;
}
$fileName = $uploadedFile->getFilename();
在这段代码后面添加文件重命名,
$fileName = date(‘YmdHis‘).‘.‘.$uploadedFile->getExtension();
时间: 2024-11-05 02:32:27