TIP게시판

제목 php 세션(서버에저장되는)을 쓰기위해서
글쓴이 최용운 작성시각 2009/10/30 21:12:38
댓글 : 1 추천 : 0 스크랩 : 0 조회수 : 15220   RSS
세션이 cookie 기반이라 다들 당황했을줄 생각합니다.


CI 미국사이트의 위키(http://codeigniter.com/wiki/Special:Titles) 에 보시면PHPSession 이라는 라이브러리가 있습니다.

이 라이브러리는 php 내장 세션을 사용합니다.

function mymethod() {
   $this
->load->library('phpsession');
   
// save a variable to the session
   
$this->phpsession->save('foo','bar');
   
// save a variable in a namespace (other than default)
   
$this->phpsession->save('foo','bar','mynamespace');
   
// read a var from the session
   
$foo = $this->phpsession->get('foo');
   
// get var from a namespace
   
$foo = $this->phpsession->get('foo','mynamespace');
   
// get all session vars (from default namespace)
   
$all = $this->phpsession->get();
   
// get all session vars from given namespace
   
$all = $this->phpsession->get(null,'mynamespace');
   
// clear session var
   
$this->phpsession->clear('foo');
   
// clear all vars (default namespace)
   
$this->phpsession->clear();
   
// clear all vars in given namespace
   
$this->phpsession->clear(null, 'mynamespace');

   
// rest of your method
   
$this->load->view('myview');
}

위 코드를 보시면 어떻게 사용하시는지 아시겠죠 ?
아직 테스트를 못해봤습니다만 필요하실 분이 계실듯하여 ...

http://codeigniter.com/wiki/PHPSession/ 여기에서 참조해주세요 ..

잘 모르겠는게 있으시면 문의주세요 .
 다음글 euc-kr에서 xss_clean버그시 대처 방법(?) (3)
 이전글 달력 Data를 배열로 가져오기 js버전. (2)

댓글

ci세상 / 2009/10/30 23:13:15 / 추천 0
좋은정보 감사드립니다.^^

좀더 심플하게 http://codeigniter-kr.org/source/view/275/page/1/ 이렇게도 추가해 보았습니다.^^