內訪問會話變量我有我的laravel應用動態CSS顏色的css文件名風格usercolors.css.php。在文件內部,我可以聲明變量並使用它,但不能訪問會話變量。css文件laravel
header("Content-type: text/css");
$primaryColor = session()->has('ORGANISATION_SETTINGS') ? session()->get('ORGANISATION_SETTINGS')['style_settings']['primary_color'] : '#F18805';
$secondaryColor = session()->has('ORGANISATION_SETTINGS') ? session()->get('ORGANISATION_SETTINGS')['style_settings']['secondary_color'] : '#20576B';
$offwhite = '#f6f6f6';
如何嘗試訪問會話變量? –
是否在文件的開頭添加了session_start()? – Difster
$ primaryColor = session() - > has('ORGANISATION_SETTINGS')? session() - > get('ORGANISATION_SETTINGS')['style_settings'] ['primary_color']:'#F18805'; @Galstyan – hizbul25