在此网址 http://localhost/yitz/Personnel/personnel_filesharing/j12 中,我只获取j12目录中的文件夹/文件,其中j12是用户名会话。
我的问题是我想将j12的文件夹和文件共享给其他用户。我使用where子句,其中表folder_shared_to是将看到共享文件夹内容的用户。我想要我的网址 http://localhost/yitz/Personnel/personnel_filesharing_shared/shared_folders ,其中shared_folders包含与您共享的文件夹。
数据库:
|folder_path | folder_shared_to|
________________________________
|filesharing/j13 | j12 |
在我的控制器中:
function personnel_filesharing_shared()
{ $this->checkLogin();
date_default_timezone_set('Asia/Manila');
$date =date("Y-m-d");
$newDate = date("F-d-Y", strtotime($date));
$data['date_today'] = $newDate;
$data['latest_events'] = $this->Model_accounts->get_events_latest($date);
$data['latest_announcements'] = $this->Model_accounts->get_personnel_announcements_latest();
$username = $_SESSION['username'];
$data['count'] = $this->Model_accounts->count_unread($username);
$user = $_SESSION['username'];
$site = $_SERVER['REQUEST_URI'];
$url_arr = explode('/',$site);
$url_count = count($url_arr);
$new_url ="";
for($x = 4; $x<$url_count;$x++)
{
if($x==$url_count-1)
{
$new_url.=$url_arr[$x];
}
else
{
$new_url.=$url_arr[$x]."/";
}
}
$url = $new_url;
$array = array('folder_path' => $url, 'folder_shared_to' => $user);
$data['folders'] = $this->db->select('*')->from('personnel_folder')->where($array)->get()->result();
$data['files'] = $this->db->select('*')->from('personnel_files')->where('file_path',$url)->get()->result();
$this->load->view('personnel/Personnel_filesharing_shared',$data);
}