' path / to / the / cache / dir'是什么意思?

时间:2016-11-27 12:19:15

标签: php

我想在我的php项目中使用phpbrowscap

要创建此类的新对象,我使用以下代码:

    / phpbrowscap follows the PSR-0 standard, so just require the composer autoload
require 'vendor/autoload.php';

// The Browscap class is in the phpbrowscap namespace, so import it
use phpbrowscap\Browscap;

// Create a new Browscap object (loads or creates the cache)
$bc = new Browscap('path/to/the/cache/dir');

// Get information about the current browser's user agent
$current_browser = $bc->getBrowser();

但我不明白要替换它的缓存目录(' path / to / the / cache / dir')。

1 个答案:

答案 0 :(得分:0)

您可以使用项目根目录中的mkdir cache自行创建缓存目录。然后确保该目录由适当的用户/组(Apache中默认为 www-data )拥有:

sudo chown www-data:www-data cache

并确保缓存目录的权限已设置为允许该用户使用以下方式进行读/写访问:

sudo chmod 644 cache
相关问题