imarc/craft-session

扩展 craft 的 session 类,允许对会话文件设置权限

1.0.0 2020-02-13 15:26 UTC

This package is auto-updated.

Last update: 2024-09-14 02:04:59 UTC


README

这是一个 Craft 3 Session 类,允许设置会话文件的掩码。

安装

使用 composer 在您的 Craft 3 项目中安装

composer require imarc/craft-session

然后,在您的 config/app.php 文件中启用并配置该类

<?php
return [
   'components' => [
		'session' => function() {
			$stateKeyPrefix = md5('Craft.' . Session::class . '.' . Craft::$app->id);

			return Craft::createObject([
				'class' => Imarc\Craft\Session::class,
				'flashParam' => $stateKeyPrefix . '__flash',
				'authAccessParam' => $stateKeyPrefix . '__auth_access',
				'name' => Craft::$app->getConfig()->getGeneral()->phpSessionName,
				'cookieParams' => Craft::cookieConfig(),

				// mask within path now supported for custom save path
				'savePath' => '0;0660;@storage/sessions'
			]);
		},
	],
];

许可协议

MIT 许可协议 (MIT)

版权

版权所有 (c) 2020 iMarc LLC