웹프로그래밍

Global It Leader!!


PHP


 
 

localStorage 활용방법

페이지 정보

작성자 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 댓글 0건 조회 4,021회 작성일 16-06-25 14:25

본문

<?
// Save an item to the local storage
function set_key($key, $data)
 {
     echo "<script language='Javascript'>localStorage.setItem('$key', '$data');</script>";
  return $this;
 }

// Get an item from the local storage (basic implementation)
function get_key($key)
{
 echo "<script language='Javascript'>return localStorage.getItem('$key'));</script>";
}

// Remove an item from the local storage
function delete_key($key)
{
    echo "<script language='Javascript'>return localStorage.getItem('$key');</script>";
}
    
// Clear the local storage
function clear_key()
{
    echo "<script>localStorage.clear();</script>";
}             
?>

<script>
function get_key(key) {
 return localStorage.getItem(key);
}
</script>
<?
set_key("ck_mb_id", "test");

$tmp_mb_id = "<script>document.write(get_key('ck_mb_id'));</script>";

echo "당신의 아이디는?".$tmp_mb_id;

?>

댓글목록

등록된 댓글이 없습니다.

전체 92
게시물 검색
PHP 목록
번호 제목 글쓴이 조회 날짜
92 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 98 01-06
91 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 105 12-22
90 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 179 10-09
89 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 190 10-09
88 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 193 10-08
87 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 231 09-03
86 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 218 07-26
85 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 222 07-26
84 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 217 07-07
83 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 205 07-07
82 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 209 06-15
81 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 272 04-23
80 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 1665 03-29
79 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4110 03-26
78 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 1848 03-26
77 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 1652 03-17
76 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 2377 11-28
75 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 2573 08-11
74 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 2184 08-10
73 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 2804 08-02