Severity: 8192
Message: Return type of CI_Session_files_driver::open($save_path, $name) should either be compatible with SessionHandlerInterface::open(string $path, string $name): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Filename: drivers/Session_files_driver.php
Line Number: 113
Severity: 8192
Message: Return type of CI_Session_files_driver::close() should either be compatible with SessionHandlerInterface::close(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Filename: drivers/Session_files_driver.php
Line Number: 280
Severity: 8192
Message: Return type of CI_Session_files_driver::read($session_id) should either be compatible with SessionHandlerInterface::read(string $id): string|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Filename: drivers/Session_files_driver.php
Line Number: 145
Severity: 8192
Message: Return type of CI_Session_files_driver::write($session_id, $session_data) should either be compatible with SessionHandlerInterface::write(string $id, string $data): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Filename: drivers/Session_files_driver.php
Line Number: 223
Severity: 8192
Message: Return type of CI_Session_files_driver::destroy($session_id) should either be compatible with SessionHandlerInterface::destroy(string $id): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Filename: drivers/Session_files_driver.php
Line Number: 303
Severity: 8192
Message: Return type of CI_Session_files_driver::gc($maxlifetime) should either be compatible with SessionHandlerInterface::gc(int $max_lifetime): int|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Filename: drivers/Session_files_driver.php
Line Number: 344
Severity: Warning
Message: ini_set(): Session ini settings cannot be changed after headers have already been sent
Filename: Session/Session.php
Line Number: 281
Severity: Warning
Message: session_set_cookie_params(): Session cookie parameters cannot be changed after headers have already been sent
Filename: Session/Session.php
Line Number: 293
Severity: Warning
Message: ini_set(): Session ini settings cannot be changed after headers have already been sent
Filename: Session/Session.php
Line Number: 303
Severity: Warning
Message: ini_set(): Session ini settings cannot be changed after headers have already been sent
Filename: Session/Session.php
Line Number: 313
Severity: Warning
Message: ini_set(): Session ini settings cannot be changed after headers have already been sent
Filename: Session/Session.php
Line Number: 314
Severity: Warning
Message: ini_set(): Session ini settings cannot be changed after headers have already been sent
Filename: Session/Session.php
Line Number: 315
Severity: Warning
Message: ini_set(): Session ini settings cannot be changed after headers have already been sent
Filename: Session/Session.php
Line Number: 316
Severity: Warning
Message: session_set_save_handler(): Session save handler cannot be changed after headers have already been sent
Filename: Session/Session.php
Line Number: 107
Severity: Warning
Message: session_start(): Session cannot be started after headers have already been sent
Filename: Session/Session.php
Line Number: 140
Severity: 8192
Message: setcookie(): Passing null to parameter #7 ($httponly) of type bool is deprecated
Filename: core/Input.php
Line Number: 410
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/hakantas/public_html/system/core/Exceptions.php:272)
Filename: core/Input.php
Line Number: 410
Web Storage bize veri depolamak için 2 seçenek sunmakta. Bu yazıda bu seçeneklerden biri olan Local Storage'dan (Yerel Depolama) bahsedeceğim. Local Storage mantığı tıpkı persistent cookies (kalıcı çerezler) gibidir. Veriler bilgisayarda (tarayıcıya göre konum değişebilir) depolanır. Tarayıcı geçmişi silinene kadar, kullanıcı verileri silene kadar ya da tarayıcı silinene kadar veriler kaybolmaz. Local Storage özelliği Javascript ile kullanılır. Depolama işlemleri yapılırken HTML5 ile birlikte hazır olarak gelen localStorage nesnesinden yararlanılır.
Local Storage'a Veri Ekleme
Local Storage'a veri eklemek için localStorage nesnesinin setItem() metodu kullanılır. Çerezlerde olduğu gibi yine key-value tanımlaması geçerlidir.
Kullanımı ve Örnek
localStorage.setItem(key, value);
localStorage.setItem("isim","Hakan");
key: Değerin hangi isimle depolanacağını belirtir.
value: Depolanacak değeri belirtir.
"isim" değişkenine "Hakan" değerini atayıp veriyi depolar. Depolanan veri bilgisayarda tutulur. Tarayıcılar sayesinde hangi verilerin depolandığını görmek mümkündür. Örneğin; Chrome ile "Öğeyi Denetle" seçeneğinden "Resources" sekmesine girip, soldaki menüden Local Storage'a tıklandığında hangi sitede hangi verilerin depolandığı karşınıza çıkacaktır.
Local Storage'dan Veri Okuma
Local Storage'dan veri okumak için localStorage nesnesinin getItem() metodu kullanılır.
Kullanımı ve Örnek
localStorage.getItem(key);
localStorage.getItem("isim");
key: Hangi depolanan değerin okunacağını belirtir.
"isim" değişkenindeki veriyi okur. İlk örneğe göre "isim" değişkeninde "Hakan" depolandığına göre okunan değer de "Hakan" olacaktır.
Local Storage'dan Veri Silmek
Local Storage'dan veri silmek için localStorage nesnesinin removeItem() metodu kullanılır.
Kullanımı ve Örnek
localStorage.removeItem(key);
localStorage.removeItem("isim");
key: Hangi depolanan değerin silineceğini belirtir.
"isim" değişkenindeki veriyi siler. İlk örneğe göre "isim" değişkeninde "Hakan" depolandığına göre silinen değer de "Hakan" olacaktır.
Local Storage'daki Tüm Verileri Silmek
Local Storage'daki tüm verileri silmek için localStorage nesnesinin clear() metodu kullanılır.
Kullanımı
localStorage.clear();
Önizlemeye tıklayarak Local Storage'ın nasıl çalıştığını daha kolay anlayabilirsiniz. İsminizi girip kaydettiğinizde veriler Local Storage'a depolanır, alt satırda Local Storage'a depoladığınız veri okunur. Veriyi silmek istediğinizde sil butonuna tıklayın. Tarayıcıyı kapatıp sayfayı tekrar açtığınızda verinin kaybolmadığını göreceksiniz.