我想使用我的$_SESSION并在用户的功能中显示一个文件夹。
我试图利用Elfinder的系统,但我需要一些帮助。
我自己的html
<div class="form-group col-md-12">
<label for="client_infobanque">Ajouter un fichier</label>
<a href="../Include/elFinder/elfinder.src.html" target="_blank">Lien vers les fichiers liés à mon client</a>
</div>connector.minimal.php
$opts = array(
// 'debug' => true,
'roots' => array(
// Items volume
array(
'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED)
'path' => '../files/'.$_SESSION['Contact_id'], // path to files (REQUIRED)
'URL' => dirname($_SERVER['PHP_SELF']) . '/../files/'.$_SESSION['Contact_id'], // URL to files (REQUIRED)
'trashHash' => 't1_Lw', // elFinder's hash of trash folder感谢你们的先锋们。附言:我使用的是最新版本的Elfinder,可以在https://github.com/Studio-42/elFinder上找到
发布于 2020-11-27 18:29:29
那么,你的想法是对的,但我会做一个更好的实现。假设您存储了您的“文件”,类似于用户名,并且它与您在/contact_id/中准备的文件夹的名称相同。例如/files/pippo/是用户"pippo“的文件夹。此外,您还需要一个超级管理员,他可以控制/files/中的所有内容,可以称之为“上帝”,在连接器的顶部放入以下代码:
<?php
session_start();
if( $_SESSION['contact_id'] == 'god' ){
$userpath = '../files/';
} else if( $_SESSION['contact_id'] != 'god' ) {
$userpath = '../files/'. $_SESSION['contact_id'] . '/';
} else {
die("Forbidden Access!");
}然后用新的$userpath变量修改路径,所以...
'path' => $userpath,
'URL' => dirname($_SERVER['PHP_SELF']) . '/' . $userpath,那么回收站文件夹,在任何用户文件夹里,也...
'path' => $userpath . '.trash/',
'tmbURL' => dirname($_SERVER['PHP_SELF']) . '/' . $userpath . '.trash/.tmb/',好了。
https://stackoverflow.com/questions/57598574
复制相似问题