<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Session คืออะไร ? | SunDay</title>
	<atom:link href="https://sunday.tripinchiangmai.com/tag/session-%E0%B8%84%E0%B8%B7%E0%B8%AD%E0%B8%AD%E0%B8%B0%E0%B9%84%E0%B8%A3/feed" rel="self" type="application/rss+xml" />
	<link>https://sunday.tripinchiangmai.com</link>
	<description>Article</description>
	<lastBuildDate>Tue, 23 May 2017 08:05:03 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8</generator>
	<item>
		<title>Session คืออะไร ?</title>
		<link>https://sunday.tripinchiangmai.com/session-%e0%b8%84%e0%b8%b7%e0%b8%ad%e0%b8%ad%e0%b8%b0%e0%b9%84%e0%b8%a3.html?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=session-%25e0%25b8%2584%25e0%25b8%25b7%25e0%25b8%25ad%25e0%25b8%25ad%25e0%25b8%25b0%25e0%25b9%2584%25e0%25b8%25a3</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 16 Dec 2010 21:16:43 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Session คืออะไร ?]]></category>
		<guid isPermaLink="false">http://sunday.tripinchiangmai.com/?p=344</guid>

					<description><![CDATA[<p>Session คืออะไร ? ตัวแปร session จะถูกประกาศขึ้นมา และมีอายุอยู่ตราบเท่าที่ browser ยังคงเปิดใช้งาน นั่นคือ ถ้าปิด browser หมายถึงการทำลาย ตัวแปร session โดยที่ ตัวแปร session จะเก็บเป็น file ไว้ที่ ทาง ฝั่ง server ส่วน cookie นั้น ตัวแปรใน cookie จะเก็บเป็น file ไว้ที่ทางฝั่ง client เพื่อเก็บค่าในตัวแปร ได้ตามที่เราต้องการ ถึงแม้ว่าจะปิด browser ไปแล้ว ใช้ session_register() เพื่อประกาศตัวแปร Session ยกตัวอย่างเช่น &#60;? session_register(&#8216;mysession&#8217;); $_SESSION[&#8220;mysession&#8221;] = &#8220;testsession&#8221;; // ใส่ค่าเข้าตัวแปร session ?&#62; ใช้ session_start() ในการเรียกใช้งาน [&#8230;]</p>
The post <a href="https://sunday.tripinchiangmai.com/session-%e0%b8%84%e0%b8%b7%e0%b8%ad%e0%b8%ad%e0%b8%b0%e0%b9%84%e0%b8%a3.html">Session คืออะไร ?</a> first appeared on <a href="https://sunday.tripinchiangmai.com">SunDay</a>.]]></description>
										<content:encoded><![CDATA[<p>Session คืออะไร ?<br />
ตัวแปร session จะถูกประกาศขึ้นมา และมีอายุอยู่ตราบเท่าที่ browser ยังคงเปิดใช้งาน นั่นคือ ถ้าปิด browser หมายถึงการทำลาย ตัวแปร session โดยที่ ตัวแปร session จะเก็บเป็น file ไว้ที่ ทาง ฝั่ง server<br />
ส่วน cookie นั้น ตัวแปรใน cookie จะเก็บเป็น file ไว้ที่ทางฝั่ง client เพื่อเก็บค่าในตัวแปร ได้ตามที่เราต้องการ ถึงแม้ว่าจะปิด browser ไปแล้ว<br />
ใช้ session_register() เพื่อประกาศตัวแปร Session<br />
ยกตัวอย่างเช่น<br />
&lt;?<br />
session_register(&#8216;mysession&#8217;);<br />
$_SESSION[&#8220;mysession&#8221;] = &#8220;testsession&#8221;; // ใส่ค่าเข้าตัวแปร session<br />
?&gt;<br />
ใช้ session_start() ในการเรียกใช้งาน<br />
ยกตัวอย่างเช่น ในหน้าอื่นที่ต้องการใช้งาน ตัวแปร session ทำได้ดังนี้<br />
&lt;?<br />
session_start();<br />
print $_SESSION[&#8220;mysession&#8221;] ;// แสดงค่าในตัวแปร session<br />
?&gt;<br />
สิ่งสำคัญ : ฟังก์ชั่น session_start() จะต้องอยู่ก่อนแท็ก &lt;html&gt; และ &lt;head&gt; เสมอ หรือ ก่อนส่วนที่เป็น Header ของ Html ไฟล์นั่นเอง<br />
ใช้ session_unregister ในการลบตัวแปร session<br />
ต้องการ ลบตัวแปร session ที่ละตัว เช่น session_unregister(&#8216;mysession&#8217;);<br />
ถ้าต้องการ ลบตัวแปร session ทั้งหมด ใช้ session_destroy();<br />
ตัวแปร session เก็บที่ไหน ?<br />
โดย Default จะเก็บที่ /tmp แต่สามารถ config ได้ ในไฟล์ php.ini ใน ตัวแปร session.save_path</p>
<input type="hidden" id="url344" class="posturl" value="https://sunday.tripinchiangmai.com/session-%e0%b8%84%e0%b8%b7%e0%b8%ad%e0%b8%ad%e0%b8%b0%e0%b9%84%e0%b8%a3.html" />
					<input type="hidden" id="com344" class="postcom" value="0" />The post <a href="https://sunday.tripinchiangmai.com/session-%e0%b8%84%e0%b8%b7%e0%b8%ad%e0%b8%ad%e0%b8%b0%e0%b9%84%e0%b8%a3.html">Session คืออะไร ?</a> first appeared on <a href="https://sunday.tripinchiangmai.com">SunDay</a>.]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
