© Khmer Angkor Academy - sophearithput168

Session

PHP Session

Session ប្រើ រក្សា​ ទុក User Data នៅ Server ពេល Navigate Pages ផ្សេង​ ៗ ។ ប្រើ​ ច្រើន​ ណាស់​ ក្នុង​ Login System, Shopping Cart ជា​ ដើម​ ។

Session Data រក្សា​ ទុក Server side ≠ Cookie (Client side) — Security ល្អ​ ជាង​ !


Start Session & Store Data

PHP Code
Click "Run" to execute the PHP code

Read & Check Session

PHP Code
Click "Run" to execute the PHP code

Destroy Session (Logout)

PHP Code
Click "Run" to execute the PHP code
⚠️ ចំណាំ: session_start() ត្រូវ Call ខាង​ ដើម​ File ជា​ ដំបូង — មុន Output HTML ណា​ ក៏​ ដោយ​ !