这是我的代码。
$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)
)
)
);
答案 0 :(得分:2)
通常浏览器只会打开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>
现在重启服务器。
修改打击代码中的网址
$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)
)
)
);
希望它能起作用:)。
答案 1 :(得分:0)
您的网址不正确。请参阅documentation中的示例:
$opts = array(
'locale' => '',
'roots' => array(
array(
'driver' => 'LocalFileSystem',
'path' => '/path/to/files/',
'URL' => 'http://localhost/to/files/'
)
)
);