我正在添加新的空中间件并收到错误消息:
“[Emergency] Uncaught BadMethodCallException:会话在启动之前无法访问”
<?php
use SilverStripe\Control\Middleware\HTTPMiddleware;
use SilverStripe\Control\HTTPRequest;
class MyMiddleware implements HTTPMiddleware
{
public function process(HTTPRequest $request, callable $delegate){
$response = $delegate($request);
return $response;
}
}
---
Name: myrequestprocessors
After:
- 'requestprocessors'
---
SilverStripe\Core\Injector\Injector:
SilverStripe\Control\Director:
properties:
Middlewares:
- '%$MyMiddleware'
食谱-cms v1.0.3
是否有解决方法来防止此错误并使中间件正常工作?