在文件夹内的 elfinder 中映射驱动器

Mapping a drive in elfinder inside files folder

  1. 这里我在elfinder中映射D盘
  2. 我无法打开文件。

这是我的代码。

$opts = array(
        // 'debug' => true,
        'roots' => array(
            array(
                'driver'        => 'LocalFileSystem',   // driver for accessing file system (REQUIRED)
                'path'          => 'D:/pdf/', // path to files (REQUIRED)
                'URL'           => 'D:/pdf/',  // URL to files (REQUIRED)
                'accessControl' => 'access'    // disable and hide dot starting files (OPTIONAL)
            )
        )
    );

您的URL不正确。请参阅 documentation 中的示例:

$opts = array(
    'locale' => '',
    'roots'  => array(
        array(
            'driver' => 'LocalFileSystem',
            'path'   => '/path/to/files/',
            'URL'    => 'http://localhost/to/files/'
        )
    )
);

通常浏览器只会打开 url 而不是路径。我们必须将路径转换为 ​​url.

如果要映射驱动器(D 驱动器),请在 XAMMP 中创建一个虚拟目录。 在 httpd-vhosts.conf

添加以下代码
<VirtualHost *:80>
   <Directory "D:/pdf">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Order Deny,Allow
    Allow from all
    Require all granted
  </Directory>
   ServerAdmin anbu@local.dev
   DocumentRoot "D:/pdf"
   ServerName local.dev
</VirtualHost>

现在重启你的服务器。

修改代码中的url

$opts = array(
    // 'debug' => true,
    'roots' => array(
        array(
            'driver'        => 'LocalFileSystem',   // driver for accessing file system (REQUIRED)
            'path'          => 'D:/pdf/', // path to files (REQUIRED)
            'URL'           => 'http://local.dev',  // URL to files (REQUIRED)
            'accessControl' => 'access'    // disable and hide dot starting files (OPTIONAL)
        )
    )
);

希望它能奏效:)