我试图在zend中使用。
zend是可以的,但是当我尝试添加zend-cache时,我得到了这样的消息:
无法将服务"FilesystemCache“解析为工厂;您确定您在配置期间提供了它吗?
我在global.php的缓存配置如下:
// Cache configuration.
'caches' => [
'FilesystemCache' => [
'adapter' => [
'name' => Filesystem::class,
'options' => [
// Store cached data in this directory.
'cache_dir' => './data/cache',
// Store cached data for 1 hour.
'ttl' => 60*60*1
],
],
'plugins' => [
[
'name' => 'serializer',
'options' => [
],
],
],
],
],在我的RbacManagerFactory中,我这样称呼它:
$cache = $container->get('FilesystemCache');我已经尝试在模块中配置FilesystemService,如下所示:
'service_manager' => [
'factories' => [
\Zend\Cache\Storage\Adapter\FilesystemService::class => InvokableFactory::class,
],
],但这不起作用
我需要配置更多的东西吗?
编辑2018-10-29
当我试图运行示例时,它会出现以下错误:
[Mon Oct 29 12:06:13.097747 2018] [php7:warn] [pid 943] [client 127.0.0.1:48824] PHP Warning: file_put_contents(data/cache/module-config-cache.application.config.cache.php): failed to open stream: No such file or directory in /var/www/html/roledemo/vendor/zendframework/zend-modulemanager/src/Listener/AbstractListener.php on line 65
[Mon Oct 29 12:06:13.098593 2018] [php7:warn] [pid 943] [client 127.0.0.1:48824] PHP Warning: file_put_contents(data/cache/module-classmap-cache.application.module.cache.php): failed to open stream: No such file or directory in /var/www/html/roledemo/vendor/zendframework/zend-modulemanager/src/Listener/AbstractListener.php on line 65
[Mon Oct 29 12:06:13.112886 2018] [php7:error] [pid 943] [client 127.0.0.1:48824] PHP Fatal error: Method Zend\\View\\Helper\\HeadTitle::__toString() must not throw an exception, caught Zend\\I18n\\Exception\\ExtensionNotLoadedException: Zend\\I18n\\Translator component requires the intl PHP extension in /var/www/html/roledemo/module/Application/view/layout/layout.phtml on line 0我不能访问任何网址。
是我的php版本还是apache版本?
发布于 2019-01-18 12:05:10
所以我错过了一些东西,这就是为什么它以前不起作用的原因:
data/cache文件夹并授予其权限775public/img/captcha文件夹并授予其权限775Zend\Serializer和Zend\Cache添加到config/modules.config.phpmodule/Login/config/module.config.php 'rbac_manager' => [
'assertions' => [Service\RbacAssertionManager::class],
],$result第72行中将src/Service/RbacManager.php设置为falsehttps://stackoverflow.com/questions/51969319
复制相似问题