CakePHP 把ckfinder不作为controller的配置

CakePHP是MVC的架构模型,并且约定了controller出现的位置,所以它会在你集成完ckfinder后把ckfinder.html作为controller处理的异常.为了解决这个问题你需要在app/config/routes.php中作如下配置:
/**
* bypass MVC interpret url that contain "ckfinder.html" 
*/  
Router::connect  
    (  
        '/:ckfinder.html',
        array  
        (  
            'ckfinder.html' => 'ckfinder.html[a-zA-Z\-_]+'  
        )  
    ); 


另外我还遇到一个问题,就是当我用ckfinder上传完文件后在编辑器中显示不出来,也是类似把目录认成了controller,这种情况一般是因为你在ckfinder的config.php中配置的basedir有误造成的:
/*
$baseDir : the path to the local directory (in the server) which points to the
above $baseUrl URL. This is the path used by CKFinder to handle the files in
the server. Full write permissions must be granted to this directory.

Examples:
	// You may point it to a directory directly:
	$baseDir = '/home/login/public_html/ckfinder/files/';
	$baseDir = 'C:/SiteDir/CKFinder/userfiles/';

	// Or you may let CKFinder discover the path, based on $baseUrl:
	$baseDir = resolveUrl($baseUrl);

ATTENTION: The trailing slash is required.
*/
#$baseDir = resolveUrl($baseUrl);
$baseDir = 'e:/myphp/linkwiki/app/webroot/userfiles/'.$userName.'/';


如果你把这个路径配置错误的话,你用类似这个url访问:
http://localhost/linkwiki/userfiles/lime/images/DSCF0040.jpg
就会报没有找到userfile这个controller的错误。



你可能感兴趣的:(html,c,mvc,PHP,cakephp)