Created
July 18, 2012 03:27
-
-
Save koriym/3133981 to your computer and use it in GitHub Desktop.
Sunday的セッション素案
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @Inject | |
*/ | |
public function setSession(Session $session) | |
{ | |
$this->session = $session | |
} | |
@Injectで受け取るこのコードはtraitにする。 | |
利用コードはこのように | |
use SessionInject; | |
... | |
$session = $this->session; | |
$session['name'] = 'hoge'; | |
素の$_SESSIONと基本の使い方を同じにする(arrayAccessする) | |
スタティックコール、利用コードでのnewは非推奨。 | |
参考URL | |
http://blog.elkc.net/?p=725 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment