1
我需要从之前得到一个变量的硅石,并获得它的中间件外:Silex的中间件节约变量和存取权限它控制器
$app->before(function (Request $request, Application $app) {
if ($request->getMethod() !== "OPTIONS") {
$bearer = $request->headers->get('Authorization');
$app["bearer"] = $bearer;
echo $app["bearer"]; // Works and display value
}
return null;
}, Application::EARLY_EVENT);
echo $app["bearer"]; // Don't works, Display "" :'(
感谢