php ckfinder basedir,php – 如何将CKFinder与Laravel集成?

我正在尝试将CKFinder与Laravel整合在一起,而我在那里的成绩约为95%.我可以让一切工作,除了CheckAuthentication函数 – 我必须使它返回true,无论上传工作.

我尝试做的是在config.php文件中引导Laravel,然后检查用户是否已登录,如下所示:

公共/包/ ckfinder / config.php文件

/*

* ### CKFinder : Configuration File - Basic Instructions

*

* In a generic usage case, the following tasks must be done to configure

* CKFinder:

* 1. Check the $baseUrl and $baseDir variables;

* 2. If available, paste your license key in the "LicenseKey" setting;

* 3. Create the CheckAuthentication() function that enables CKFinder for authenticated users;

*

* Other settings may be left with their default values, or used to control

* advanced features of CKFinder.

*/

/** RIPPED FROM public/index.php **/

/*

|--------------------------------------------------------------------------

| Register The Auto Loader

|--------------------------------------------------------------------------

|

| Composer provides a convenient, automatically generated class loader

| for our application. We just need to utilize it! We'll require it

| into the script here so that we do not have to worry about the

| loading of any our classes "manually". Feels great to relax.

|

*/

require __DIR__.'/../../../bootstrap/autoload.php';

/*

|--------------------------------------------------------------------------

| Turn On The Lights

|--------------------------------------------------------------------------

|

| We need to illuminate PHP development, so let's turn on the lights.

| This bootstraps the framework and gets it ready for use, then it

| will load up this application so that we can run it and send

| the responses back to the browser and delight these users.

|

*/

$app = require __DIR__.'/../../../bootstrap/start.php';

/** END public/index.php **/

/**

* This function must check the user session to be sure that he/she is

* authorized to upload and access files in the File Browser.

*

* @return boolean

*/

function CheckAuthentication()

{

// WARNING : DO NOT simply return "true". By doing so, you are allowing

// "anyone" to upload and list the files in your server. You must implement

// some kind of session validation here. Even something very simple as...

return Auth::check();

}

但是,这总是返回false.我也尝试直接使用Laravel的Session在某人登录时将变量设置为true,在他们注销时将其设置为false,然后在config.php文件中检查该变量,但它始终在Session :: get中返回默认值(“IsAuthorized”,false);;任何人都可以提供一些指导 –

1)如何验证是否允许用户上传?

2)为什么在另一个文件中引导Laravel似乎会导致它使用单独的会话,即使它正在加载相同的文件?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值