Taninut.com
หน้าหลัก
สร้างสินค้า
Home
- กลุ่มสินค้า
(Product class)
- สินค้าสร้างใหม่
(Product create)
คูปอง
- สร้างคูปอง
(Coupons create)
- การใช้คูปอง
(Coupons use)
คำสั่งซื้อ(Orders)
- Orders
- Orders booking
เพิ่มเติม
- Content
- Article
- FAQs
แดชบอร์ดรวม
ประวัติการจอง
การตั้งค่า
ออกจากระบบ
Update Article: 157
Category ID
เลือกหมวดหมู่
IT
PHP
Flutter
Wordpress
SEO
Lifestyle
Travel
Breakfast
Hobby
Process
Mini Course
Website
หนังสือ
เทคโนโลยี (Technology)
ไลฟ์สไตล์ (Lifestyle)
การพัฒนาเว็บ (Web Development)
อาหารและการท่องเที่ยว (Food & Travel)
หนังสือและการเรียนรู้ (Books & Learning)
เคล็ดลับและทริคพิเศษ (Tips & Tricks)
โปรโมชั่น / ข่าวสาร
Content Name
Clear URLs
URL Off page
Content Desc
Content Desc
<div class="group w-full text-gray-800 dark:text-gray-100 border-b border-black/10 dark:border-gray-900/50 dark:bg-gray-800"> <div class="text-base gap-4 md:gap-6 md:max-w-2xl lg:max-w-xl xl:max-w-3xl p-4 md:py-6 flex lg:px-0 m-auto"> <div class="relative flex w-[calc(100%-50px)] flex-col gap-1 md:gap-3 lg:w-[calc(100%-115px)]"> <div class="flex flex-grow flex-col gap-3"> <div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap"> <div class="group w-full text-gray-800 dark:text-gray-100 border-b border-black/10 dark:border-gray-900/50 bg-gray-50 dark:bg-[#444654]"> <div class="text-base gap-4 md:gap-6 md:max-w-2xl lg:max-w-xl xl:max-w-3xl p-4 md:py-6 flex lg:px-0 m-auto"> <div class="relative flex w-[calc(100%-50px)] flex-col gap-1 md:gap-3 lg:w-[calc(100%-115px)]"> <div class="flex flex-grow flex-col gap-3"> <div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap"> <div class="markdown prose w-full break-words dark:prose-invert light"> <p><strong>Session และ Cookie </strong>เป็นเครื่องมือสำหรับเก็บข้อมูลของผู้ใช้บนเว็บไซต์ โดยสามารถใช้งานได้ง่าย ๆ โดยไม่ต้องเก็บข้อมูลลงในฐานข้อมูล</p> <p><strong>Session</strong> เป็นการเก็บข้อมูลของผู้ใช้บนเว็บไซต์ไว้ในเซิร์ฟเวอร์ โดยข้อมูลจะถูกเก็บไว้ในแฟ้มข้อมูลเซสชัน ผู้ใช้สามารถเข้าถึงข้อมูลได้ทุกครั้งที่เข้าใช้งานเว็บไซต์ โดยเซิร์ฟเวอร์จะตรวจสอบว่ามีเซสชันของผู้ใช้หรือไม่ หากมีเซสชันแล้วเซิร์ฟเวอร์จะใช้ข้อมูลในเซสชันเดิม แต่หากไม่มีเซสชันเดิมจะสร้างเซสชันใหม่และเก็บข้อมูลลงในแฟ้มข้อมูลเซสชันใหม่</p> <p><strong>ตัวอย่างการใช้งาน Session ด้วย PHP</strong></p> <div class="bg-black rounded-md mb-4"> <div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"></div> <div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-php"><span class="hljs-meta"><?php</span> <span class="hljs-comment">// Start the session</span> <span class="hljs-title function_ invoke__">session_start</span>(); <span class="hljs-comment">// Set session variables</span> <span class="hljs-variable">$_SESSION</span>[<span class="hljs-string">"username"</span>] = <span class="hljs-string">"John"</span>; <span class="hljs-variable">$_SESSION</span>[<span class="hljs-string">"favcolor"</span>] = <span class="hljs-string">"blue"</span>; <span class="hljs-keyword">echo</span> <span class="hljs-string">"Session variables are set."</span>; <span class="hljs-meta">?></span> </code></div> </div> <p>โดยเมื่อผู้ใช้เข้าใช้งานเว็บไซต์ในครั้งต่อไป Session จะทำการตรวจสอบว่ามี Session ของผู้ใช้หรือไม่ และใช้ข้อมูลเดิมหากมี Session ของผู้ใช้ หากไม่มี Session จะสร้าง Session ใหม่และเก็บข้อมูลลงใน Session ใหม่</p> <p>Cookie เป็นการเก็บข้อมูลของผู้ใช้บนเครื่องคอมพิวเตอร์ของผู้ใช้ โดยข้อมูลจะถูกเข้ารหัสและเก็บไว้ในไฟล์เอกสารเครื่องหนึ่ง และ<span>ผู้ใช้สามารถเข้าถึงข้อมูลได้ทุกครั้งที่เข้าใช้งานเว็บไซต์</span></p> </div> </div> </div> </div> </div> </div> <div class="group w-full text-gray-800 dark:text-gray-100 border-b border-black/10 dark:border-gray-900/50 bg-gray-50 dark:bg-[#444654]"> <div class="text-base gap-4 md:gap-6 md:max-w-2xl lg:max-w-xl xl:max-w-3xl p-4 md:py-6 flex lg:px-0 m-auto"> <div class="relative flex w-[calc(100%-50px)] flex-col gap-1 md:gap-3 lg:w-[calc(100%-115px)]"> <div class="flex flex-grow flex-col gap-3"> <div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap"> <div class="markdown prose w-full break-words dark:prose-invert light"> <p><strong>ตัวอย่างการใช้งาน Cookie ด้วย PHP</strong></p> <div class="bg-black rounded-md mb-4"> <div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"></div> <div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-php"><span class="hljs-meta"><?php</span> <span class="hljs-comment">// Set cookie</span> <span class="hljs-title function_ invoke__">setcookie</span>(<span class="hljs-string">"username"</span>, <span class="hljs-string">"John"</span>, <span class="hljs-title function_ invoke__">time</span>() + (<span class="hljs-number">86400</span> * <span class="hljs-number">30</span>), <span class="hljs-string">"/"</span>); <span class="hljs-comment">// expires in 30 days</span> <span class="hljs-comment">// Retrieve cookie value</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$_COOKIE</span>[<span class="hljs-string">"username"</span>]; <span class="hljs-meta">?></span> </code></div> </div> <p>โดยการใช้งาน Cookie จะมีการกำหนดชื่อของ Cookie และค่าของ Cookie โดยใช้ฟังก์ชัน setcookie() และกำหนดเวลาที่ Cookie จะหมดอายุ ในที่นี้คือ 30 วัน โดยค่าของ Cookie จะถูกเข้ารหัสและเก็บไว้ในเครื่องคอมพิวเตอร์ของผู้ใช้ และผู้ใช้สามารถเข้าถึงข้อมูลดังกล่าวได้โดยใช้ตัวแปร $_COOKIE</p> <p><strong>สรุป:</strong></p> <p>Session และ Cookie เป็นเครื่องมือสำหรับเก็บข้อมูลของผู้ใช้บนเว็บไซต์ โดย Session จะเก็บข้อมูลของผู้ใช้บนเซิร์ฟเวอร์ และ Cookie จะเก็บข้อมูลของผู้ใช้บนเครื่องคอมพิวเตอร์ของผู้ใช้ การใช้งานทั้งสองนี้มีความสำคัญในการจัดการข้อมูลของผู้ใช้ในเว็บไซต์และโปรแกรมอื่น ๆ ที่ทำงานอยู่บนเว็บไซต์นั้น ๆ</p> </div> </div> </div> </div> </div> </div> </div> <div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap"><strong></strong></div> <div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap"><strong>Session ใน Yii2 อธิบายพร้อมยกตัวอย่าง</strong></div> </div> </div> </div> </div> <div class="group w-full text-gray-800 dark:text-gray-100 border-b border-black/10 dark:border-gray-900/50 bg-gray-50 dark:bg-[#444654]"> <div class="text-base gap-4 md:gap-6 md:max-w-2xl lg:max-w-xl xl:max-w-3xl p-4 md:py-6 flex lg:px-0 m-auto"> <div class="w-[30px] flex flex-col relative items-end"></div> <div class="relative flex w-[calc(100%-50px)] flex-col gap-1 md:gap-3 lg:w-[calc(100%-115px)]"> <div class="flex flex-grow flex-col gap-3"> <div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap"> <div class="markdown prose w-full break-words dark:prose-invert light"> <p>ใน Yii2 เราสามารถใช้ Session ในการเก็บข้อมูลของผู้ใช้ได้ โดยใช้คลาส <code>yii\web\Session</code> ซึ่งเป็นคลาสที่ถูกสร้างขึ้นมาเพื่อใช้งาน Session ใน Yii2</p> <p>การใช้งาน Session ใน Yii2 สามารถทำได้ดังนี้</p> <ol> <li>เรียกใช้งาน Session</li> </ol> <div class="bg-black rounded-md mb-4"> <div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"></div> <div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-php"><span class="hljs-meta"><?php</span> <span class="hljs-comment">// Call session</span> <span class="hljs-variable">$session</span> = <span class="hljs-title class_">Yii</span>::<span class="hljs-variable">$app</span>->session; <span class="hljs-comment">// Start session if it's not started yet</span> <span class="hljs-keyword">if</span> (!<span class="hljs-variable">$session</span>->isActive) { <span class="hljs-variable">$session</span>-><span class="hljs-title function_ invoke__">open</span>(); } <span class="hljs-meta">?></span> </code></div> </div> <ol start="2"> <li>กำหนดค่า Session ด้วย <code>$session</code> ดังนี้</li> </ol> <div class="bg-black rounded-md mb-4"> <div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"></div> <div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-php"><span class="hljs-meta"><?php</span> <span class="hljs-comment">// Set session</span> <span class="hljs-variable">$session</span>-><span class="hljs-title function_ invoke__">set</span>(<span class="hljs-string">'username'</span>, <span class="hljs-string">'John Doe'</span>); <span class="hljs-meta">?></span> </code></div> </div> <ol start="3"> <li>อ่านค่าของ Session ด้วย <code>$session</code> ดังนี้</li> </ol> <div class="bg-black rounded-md mb-4"> <div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"></div> <div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-php"><span class="hljs-meta"><?php</span> <span class="hljs-comment">// Get session value</span> <span class="hljs-keyword">echo</span> <span class="hljs-variable">$session</span>-><span class="hljs-title function_ invoke__">get</span>(<span class="hljs-string">'username'</span>); <span class="hljs-meta">?></span> </code></div> </div> <ol start="4"> <li>ลบค่า Session ด้วย <code>$session</code> ดังนี้</li> </ol> <div class="bg-black rounded-md mb-4"> <div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"></div> <div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-php"><span class="hljs-meta"><?php</span> <span class="hljs-comment">// Remove session</span> <span class="hljs-variable">$session</span>-><span class="hljs-title function_ invoke__">remove</span>(<span class="hljs-string">'username'</span>); <span class="hljs-meta">?></span> </code></div> </div> <p>ตัวอย่างการใช้งาน Session ใน Yii2 ดังกล่าวจะเก็บข้อมูลของผู้ใช้ในตัวแปร Session ภายในเซสชัน โดยเซสชันจะถูกเริ่มต้นขึ้นเมื่อผู้ใช้เข้าสู่ระบบ และจะถูกเก็บไว้ภายในเซสชันไปจนกว่าผู้ใช้จะออกจากระบบ</p> <p><strong>สรุป: </strong>การใช้งาน Session ใน Yii2 เป็นการเก็บข้อมูลของผู้ใช้ในตัวแปร Session ภายในเซสชัน โดยเซสชันจะถูกเริ่มต้นขึ้นเมื่อผู้ใช้เข้าสู่ระบบ และจะถูกเก็บไว้ภายในเซสชันไปจนกว่าผู้ใช้จะออกจากระบบ</p> </div> </div> </div> </div> </div> </div> <div class="group w-full text-gray-800 dark:text-gray-100 border-b border-black/10 dark:border-gray-900/50 bg-gray-50 dark:bg-[#444654]"> <div class="text-base gap-4 md:gap-6 md:max-w-2xl lg:max-w-xl xl:max-w-3xl p-4 md:py-6 flex lg:px-0 m-auto"> <div class="relative flex w-[calc(100%-50px)] flex-col gap-1 md:gap-3 lg:w-[calc(100%-115px)]"> <div class="flex flex-grow flex-col gap-3"> <div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap"> <div class="markdown prose w-full break-words dark:prose-invert light"> <p><strong>ตัวอย่างการใช้งาน Session ใน Yii2 </strong>เพื่อเก็บข้อมูลสถานะการเข้าสู่ระบบของผู้ใช้ ดังนี้</p> <ol> <li>เรียกใช้งาน Session และกำหนดค่าเริ่มต้น</li> </ol> <div class="bg-black rounded-md mb-4"> <div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"></div> <div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-php"><span class="hljs-meta"><?php</span> <span class="hljs-comment">// Call session</span> <span class="hljs-variable">$session</span> = <span class="hljs-title class_">Yii</span>::<span class="hljs-variable">$app</span>->session; <span class="hljs-comment">// Start session if it's not started yet</span> <span class="hljs-keyword">if</span> (!<span class="hljs-variable">$session</span>->isActive) { <span class="hljs-variable">$session</span>-><span class="hljs-title function_ invoke__">open</span>(); } <span class="hljs-comment">// Set default user status</span> <span class="hljs-keyword">if</span> (!<span class="hljs-keyword">isset</span>(<span class="hljs-variable">$session</span>[<span class="hljs-string">'isUserLoggedIn'</span>])) { <span class="hljs-variable">$session</span>[<span class="hljs-string">'isUserLoggedIn'</span>] = <span class="hljs-literal">false</span>; } <span class="hljs-meta">?></span> </code></div> </div> <ol start="2"> <li>เมื่อผู้ใช้เข้าสู่ระบบสำเร็จ กำหนดค่า <code>$session</code> ให้เป็น true</li> </ol> <div class="bg-black rounded-md mb-4"> <div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"></div> <div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-php"><span class="hljs-meta"><?php</span> <span class="hljs-comment">// Login user</span> <span class="hljs-keyword">if</span> (<span class="hljs-variable">$user</span>-><span class="hljs-title function_ invoke__">login</span>()) { <span class="hljs-variable">$session</span>[<span class="hljs-string">'isUserLoggedIn'</span>] = <span class="hljs-literal">true</span>; } <span class="hljs-meta">?></span> </code></div> </div> <ol start="3"> <li>เมื่อผู้ใช้ออกจากระบบ กำหนดค่า <code>$session</code> ให้เป็น false</li> </ol> <div class="bg-black rounded-md mb-4"> <div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"></div> <div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-php"><span class="hljs-meta"><?php</span> <span class="hljs-comment">// Logout user</span> <span class="hljs-variable">$session</span>[<span class="hljs-string">'isUserLoggedIn'</span>] = <span class="hljs-literal">false</span>; <span class="hljs-variable">$user</span>-><span class="hljs-title function_ invoke__">logout</span>(); <span class="hljs-meta">?></span> </code></div> </div> <ol start="4"> <li>ตรวจสอบสถานะการเข้าสู่ระบบของผู้ใช้</li> </ol> <div class="bg-black rounded-md mb-4"> <div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"></div> <div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-php"><span class="hljs-meta"><?php</span> <span class="hljs-comment">// Check if user is logged in</span> <span class="hljs-keyword">if</span> (<span class="hljs-variable">$session</span>[<span class="hljs-string">'isUserLoggedIn'</span>]) { <span class="hljs-comment">// Show user profile</span> } <span class="hljs-keyword">else</span> { <span class="hljs-comment">// Show login form</span> } <span class="hljs-meta">?></span> </code></div> </div> <p>ตัวอย่างการใช้งาน Session ใน Yii2 เพื่อเก็บข้อมูลสถานะการเข้าสู่ระบบของผู้ใช้ จะเก็บข้อมูลสถานะการเข้าสู่ระบบของผู้ใช้ในตัวแปร Session และตรวจสอบค่าเพื่อแสดงหน้าเว็บไซต์ที่เหมาะสมกับสถานะการเข้าสู่ระบบของผู้ใช้</p> <p><strong>สรุป: </strong>การใช้งาน Session ใน Yii2 เพื่อเก็บข้อมูลสถานะการเข้าสู่ระบบของผู้ใช้ เป็นวิธีที่มีประสิทธิภาพสูงและเป็นที่นิยมในการจัดการสถานะการเข้าสู่ระบบของผู้ใช้ใน Yii2 ด้วยความสะดวกและประสิทธิภาพที่มากกว่าการใช้งาน Cookie</p> </div> </div> </div> </div> </div> </div> <div class="group w-full text-gray-800 dark:text-gray-100 border-b border-black/10 dark:border-gray-900/50 bg-gray-50 dark:bg-[#444654]"> <div class="text-base gap-4 md:gap-6 md:max-w-2xl lg:max-w-xl xl:max-w-3xl p-4 md:py-6 flex lg:px-0 m-auto"> <div class="relative flex w-[calc(100%-50px)] flex-col gap-1 md:gap-3 lg:w-[calc(100%-115px)]"> <div class="flex flex-grow flex-col gap-3"> <div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap"> <div class="markdown prose w-full break-words dark:prose-invert light"> <p><strong>Cookie ใน Yii2 อธิบายพร้อมยกตัวอย่าง</strong></p> <p><strong>Cookie</strong> เป็นเทคโนโลยีในการเก็บข้อมูลบนเว็บเบราว์เซอร์ของผู้ใช้ โดยจะเก็บข้อมูลในรูปแบบของชุดคีย์และค่า (key-value pairs) ซึ่งจะถูกส่งไปยังเซิร์ฟเวอร์ทุกครั้งที่ผู้ใช้ทำการร้องขอหน้าเว็บไซต์</p> <p>การตั้งค่า Cookie สามารถทำได้ดังนี้</p> <ol> <li>ตั้งค่าค่าโดเมนของ Cookie ด้วย <code>domain</code></li> </ol> <div class="bg-black rounded-md mb-4"> <div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"></div> <div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-php"><span class="hljs-meta"><?php</span> <span class="hljs-comment">// Set cookie domain</span> <span class="hljs-title function_ invoke__">setcookie</span>(<span class="hljs-string">'username'</span>, <span class="hljs-string">'John Doe'</span>, <span class="hljs-title function_ invoke__">time</span>() + (<span class="hljs-number">86400</span> * <span class="hljs-number">30</span>), <span class="hljs-string">'/'</span>, <span class="hljs-string">'example.com'</span>); <span class="hljs-meta">?></span> </code></div> </div> <ol start="2"> <li>ตั้งค่าพาธของ Cookie ด้วย <code>path</code></li> </ol> <div class="bg-black rounded-md mb-4"> <div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"></div> <div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-php"><span class="hljs-meta"><?php</span> <span class="hljs-comment">// Set cookie path</span> <span class="hljs-title function_ invoke__">setcookie</span>(<span class="hljs-string">'username'</span>, <span class="hljs-string">'John Doe'</span>, <span class="hljs-title function_ invoke__">time</span>() + (<span class="hljs-number">86400</span> * <span class="hljs-number">30</span>), <span class="hljs-string">'/admin'</span>); <span class="hljs-meta">?></span> </code></div> </div> <p>ตัวอย่างการตั้งค่า Cookie ด้วย <code>domain</code> และ <code>path</code> ใน PHP ดังกล่าวจะกำหนดให้ Cookie ที่ชื่อว่า <code>username</code> มีอายุเป็น 30 วัน และจะสามารถอ่านได้จากทุกพาธที่อยู่ภายใต้โดเมน <code>example.com</code> และพาธ <code>/admin</code> เท่านั้น</p> <p>สรุป: การตั้งค่า Cookie สามารถใช้ <code>domain</code> และ <code>path</code> เพื่อกำหนดขอบเขตของ Cookie และสามารถตั้งค่าได้ในภาษา PHP โดยใช้ฟังก์ชัน <code>setcookie()</code> ที่รองรับการตั้งค่าเพิ่มเติมและอื่น ๆ อีกมากมาย</p> </div> </div> </div> </div> </div> </div> <div class="group w-full text-gray-800 dark:text-gray-100 border-b border-black/10 dark:border-gray-900/50 dark:bg-gray-800"> <div class="text-base gap-4 md:gap-6 md:max-w-2xl lg:max-w-xl xl:max-w-3xl p-4 md:py-6 flex lg:px-0 m-auto"> <div class="w-[30px] flex flex-col relative items-end"> <div class="text-xs flex items-center justify-center gap-1 invisible absolute left-0 top-2 -ml-4 -translate-x-full group-hover:visible !invisible"></div> </div> <div class="relative flex w-[calc(100%-50px)] flex-col gap-1 md:gap-3 lg:w-[calc(100%-115px)]"> <div class="flex flex-grow flex-col gap-3"> <div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap"><strong>Cookie ใน Yii2 อธิบายพร้อมยกตัวอย่าง</strong></div> </div> </div> </div> </div> <div class="group w-full text-gray-800 dark:text-gray-100 border-b border-black/10 dark:border-gray-900/50 bg-gray-50 dark:bg-[#444654]"> <div class="text-base gap-4 md:gap-6 md:max-w-2xl lg:max-w-xl xl:max-w-3xl p-4 md:py-6 flex lg:px-0 m-auto"> <div class="relative flex w-[calc(100%-50px)] flex-col gap-1 md:gap-3 lg:w-[calc(100%-115px)]"> <div class="flex flex-grow flex-col gap-3"> <div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap"> <div class="markdown prose w-full break-words dark:prose-invert light"> <p>ใน Yii2 สามารถใช้คลาส <code>yii\web\Cookie</code> เพื่อจัดการกับ Cookie ได้ง่ายๆ โดยมีเมทอดสำคัญดังนี้</p> <ol> <li><code>yii\web\Cookie::set()</code> - ใช้สำหรับตั้งค่าค่าของ Cookie</li> <li><code>yii\web\Cookie::get()</code> - ใช้สำหรับอ่านค่าของ Cookie</li> <li><code>yii\web\Cookie::expire</code> - ใช้สำหรับกำหนดเวลาหมดอายุของ Cookie</li> </ol> <p>ตัวอย่างการตั้งค่า Cookie ด้วยคลาส <code>yii\web\Cookie</code> ใน Yii2 ดังนี้</p> <div class="bg-black rounded-md mb-4"> <div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"></div> <div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-php"><span class="hljs-meta"><?php</span> <span class="hljs-keyword">use</span> <span class="hljs-title">yii</span>\<span class="hljs-title">web</span>\<span class="hljs-title">Cookie</span>; <span class="hljs-comment">// Set a cookie</span> <span class="hljs-variable">$cookie</span> = <span class="hljs-keyword">new</span> <span class="hljs-title class_">Cookie</span>([ <span class="hljs-string">'name'</span> => <span class="hljs-string">'username'</span>, <span class="hljs-string">'value'</span> => <span class="hljs-string">'John Doe'</span>, <span class="hljs-string">'expire'</span> => <span class="hljs-title function_ invoke__">time</span>() + <span class="hljs-number">86400</span> * <span class="hljs-number">30</span>, <span class="hljs-comment">// 30 days</span> ]); <span class="hljs-title class_">Yii</span>::<span class="hljs-variable">$app</span>->response->cookies-><span class="hljs-title function_ invoke__">add</span>(<span class="hljs-variable">$cookie</span>); <span class="hljs-comment">// Get a cookie</span> <span class="hljs-variable">$username</span> = <span class="hljs-title class_">Yii</span>::<span class="hljs-variable">$app</span>->request->cookies-><span class="hljs-title function_ invoke__">getValue</span>(<span class="hljs-string">'username'</span>); <span class="hljs-meta">?></span> </code></div> </div> <p>ในตัวอย่างดังกล่าว เราใช้ <code>$cookie</code> ในการตั้งค่า Cookie ที่มีชื่อว่า <code>username</code> และมีค่าเป็น <code>John Doe</code> โดย Cookie นี้จะหมดอายุใน 30 วัน และถูกเพิ่มลงในการตอบกลับด้วย <code>$app->response->cookies</code> ซึ่งเป็นอ็อบเจกต์ของ <code>yii\web\Response</code> ส่วนการอ่านค่า Cookie เราใช้ <code>$app->request->cookies</code> ซึ่งเป็นอ็อบเจกต์ของ <code>yii\web\Request</code></p> <p>สรุป: ใน Yii2 สามารถใช้คลาส <code>yii\web\Cookie</code> เพื่อจัดการกับ Cookie ได้ง่ายๆ โดยใช้เมทอด <code>set()</code> เพื่อตั้งค่า Cookie และ <code>get()</code> เพื่ออ่านค่า Cookie และ <code>expire</code> เพื่อกำหนดเวลาหมดอายุของ Cookie ซึ่งสามารถเพิ่มลงในการตอบกลับด้วย <code>$app->response->cookies</code> และอ่านค่าด้วย <code>$app->request->cookies</code></p> </div> </div> </div> </div> </div> </div> <div class="group w-full text-gray-800 dark:text-gray-100 border-b border-black/10 dark:border-gray-900/50 bg-gray-50 dark:bg-[#444654]"> <div class="text-base gap-4 md:gap-6 md:max-w-2xl lg:max-w-xl xl:max-w-3xl p-4 md:py-6 flex lg:px-0 m-auto"> <div class="w-[30px] flex flex-col relative items-end"></div> <div class="relative flex w-[calc(100%-50px)] flex-col gap-1 md:gap-3 lg:w-[calc(100%-115px)]"> <div class="flex flex-grow flex-col gap-3"> <div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap"> <div class="markdown prose w-full break-words dark:prose-invert light"> <p>การใช้งาน Cookie ใน Yii2 สามารถนำมาใช้ในงานต่างๆ ได้ เช่น</p> <ol> <li>การจดจำค่าต่างๆ ของผู้ใช้ เช่น การจดจำภาษาที่ผู้ใช้เลือกใช้ เพื่อแสดงเนื้อหาในภาษาเดียวกันทุกครั้งที่ผู้ใช้เข้าชมเว็บไซต์</li> <li>การเก็บค่าสถานะของผู้ใช้ เช่น การเก็บค่าการล็อกอินของผู้ใช้ เพื่อให้ไม่ต้องล็อกอินใหม่ทุกครั้งที่เข้าชมเว็บไซต์</li> <li>การติดตามการใช้งานของผู้ใช้ เช่น การติดตามประวัติการเรียกใช้หน้าเว็บไซต์ต่างๆ เพื่อปรับปรุงประสิทธิภาพและประสิทธิผลของเว็บไซต์</li> </ol> <p>ตัวอย่างการใช้งาน Cookie ใน Yii2 สำหรับการจดจำภาษาที่ผู้ใช้เลือกใช้ เพื่อแสดงเนื้อหาในภาษาเดียวกันทุกครั้งที่ผู้ใช้เข้าชมเว็บไซต์ ดังนี้</p> <div class="bg-black rounded-md mb-4"> <div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"></div> <div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-php"><span class="hljs-meta"><?php</span> <span class="hljs-keyword">use</span> <span class="hljs-title">Yii</span>; <span class="hljs-keyword">use</span> <span class="hljs-title">yii</span>\<span class="hljs-title">web</span>\<span class="hljs-title">Cookie</span>; <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">LanguageController</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">Controller</span> </span>{ <span class="hljs-keyword">public</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">actionSetLanguage</span>(<span class="hljs-params"><span class="hljs-variable">$language</span></span>) </span>{ <span class="hljs-comment">// Set language cookie</span> <span class="hljs-variable">$cookie</span> = <span class="hljs-keyword">new</span> <span class="hljs-title class_">Cookie</span>([ <span class="hljs-string">'name'</span> => <span class="hljs-string">'language'</span>, <span class="hljs-string">'value'</span> => <span class="hljs-variable">$language</span>, <span class="hljs-string">'expire'</span> => <span class="hljs-title function_ invoke__">time</span>() + <span class="hljs-number">86400</span> * <span class="hljs-number">30</span>, <span class="hljs-comment">// 30 days</span> ]); <span class="hljs-title class_">Yii</span>::<span class="hljs-variable">$app</span>->response->cookies-><span class="hljs-title function_ invoke__">add</span>(<span class="hljs-variable">$cookie</span>); <span class="hljs-comment">// Redirect back to previous page</span> <span class="hljs-keyword">return</span> <span class="hljs-variable language_">$this</span>-><span class="hljs-title function_ invoke__">redirect</span>(<span class="hljs-title class_">Yii</span>::<span class="hljs-variable">$app</span>->request->referrer ?: <span class="hljs-title class_">Yii</span>::<span class="hljs-variable">$app</span>->homeUrl); } } </code></div> </div> <p>ในตัวอย่างดังกล่าว เมื่อผู้ใช้เลือกภาษาที่ต้องการใช้งาน ระบบจะตั้งค่า Cookie ชื่อว่า <code>language</code> ซึ่งมีค่าเท่ากับภาษาที่ผู้ใช้เลือก และจะหมดอายุใน 30 วัน </p> <p>การตั้งค่าอายุของ Cookie นั้นจะทำได้โดยการกำหนดค่า parameter expires ในฟังก์ชัน setcookie() โดยค่านี้จะระบุเวลาที่ Cookie จะหมดอายุ โดยกำหนดเป็นจำนวนวินาทีตั้งแต่เวลา Unix Epoch (1 มกราคม ค.ศ. 1970) จนถึงเวลาที่ต้องการให้หมดอายุ ดังนั้นถ้าต้องการให้ Cookie หมดอายุใน 30 วัน จะต้องกำหนดค่า expires ดังนี้</p> <div class="bg-black rounded-md mb-4"> <div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-php"><span class="hljs-variable">$expires</span> = <span class="hljs-title function_ invoke__">time</span>() + (<span class="hljs-number">30</span> * <span class="hljs-number">24</span> * <span class="hljs-number">60</span> * <span class="hljs-number">60</span>); <span class="hljs-comment">// 30 วัน</span> <span class="hljs-title function_ invoke__">setcookie</span>(<span class="hljs-string">"mycookie"</span>, <span class="hljs-string">"myvalue"</span>, <span class="hljs-variable">$expires</span>); </code></div> </div> <p>ในตัวอย่างด้านบน ตัวแปร $expires จะถูกกำหนดค่าเป็นจำนวนวินาทีที่ผ่านมาตั้งแต่เวลา Unix Epoch (1 มกราคม ค.ศ. 1970) บวกด้วย 30 วัน (คูณ 24 ชั่วโมง คูณ 60 นาที คูณ 60 วินาที) เพื่อกำหนดเวลาที่ Cookie จะหมดอายุ</p> <p>อย่างไรก็ตาม การตั้งค่าอายุของ Cookie นั้นมีข้อจำกัดบางอย่าง เช่น อาจมีการปรับเปลี่ยนเวลาในเครื่องผู้ใช้งาน ซึ่งอาจทำให้ Cookie หมดอายุก่อนเวลาที่กำหนดไว้ นอกจากนี้ ผู้ใช้งานยังสามารถลบ Cookie ได้ด้วย ดังนั้นการใช้งาน Cookie ควรคำนึงถึงความเป็นไปได้ที่จะเกิดข้อผิดพลาดในการกำหนดเวลาหมดอายุของ Cookie</p> </div> </div> </div> </div> </div> </div> <div class="group w-full text-gray-800 dark:text-gray-100 border-b border-black/10 dark:border-gray-900/50 bg-gray-50 dark:bg-[#444654]"> <div class="text-base gap-4 md:gap-6 md:max-w-2xl lg:max-w-xl xl:max-w-3xl p-4 md:py-6 flex lg:px-0 m-auto"> <div class="relative flex w-[calc(100%-50px)] flex-col gap-1 md:gap-3 lg:w-[calc(100%-115px)]"> <div class="flex flex-grow flex-col gap-3"> <div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap"> <div class="markdown prose w-full break-words dark:prose-invert light"> <p>เพื่อให้เว็บไซต์สามารถอ่านค่า Cookie ที่ตั้งค่าไว้ในเครื่องของผู้ใช้ได้ สามารถใช้เมธอด <code>getCookies()</code> ของออบเจ็กต์ <code>yii\web\Request</code> เพื่อดึงข้อมูล Cookie ออกมาใช้งานได้ ดังนี้</p> <div class="bg-black rounded-md mb-4"> <div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-php"><span class="hljs-meta"><?php</span> <span class="hljs-keyword">use</span> <span class="hljs-title">Yii</span>; <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">SiteController</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">Controller</span> </span>{ <span class="hljs-keyword">public</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">actionIndex</span>(<span class="hljs-params"></span>) </span>{ <span class="hljs-comment">// Get language cookie</span> <span class="hljs-variable">$language</span> = <span class="hljs-title class_">Yii</span>::<span class="hljs-variable">$app</span>->request->cookies-><span class="hljs-title function_ invoke__">get</span>(<span class="hljs-string">'language'</span>); <span class="hljs-comment">// Set default language if cookie not set</span> <span class="hljs-keyword">if</span> (<span class="hljs-variable">$language</span> === <span class="hljs-literal">null</span>) { <span class="hljs-variable">$language</span> = <span class="hljs-string">'en'</span>; <span class="hljs-comment">// default language</span> } <span class="hljs-comment">// Set application language</span> <span class="hljs-title class_">Yii</span>::<span class="hljs-variable">$app</span>->language = <span class="hljs-variable">$language</span>; <span class="hljs-keyword">return</span> <span class="hljs-variable language_">$this</span>-><span class="hljs-title function_ invoke__">render</span>(<span class="hljs-string">'index'</span>); } } </code></div> </div> <p>ในตัวอย่างดังกล่าว เมื่อผู้ใช้เข้าชมหน้าเว็บไซต์ ระบบจะดึงค่า Cookie ชื่อว่า <code>language</code> ออกมา โดยใช้เมธอด <code>get()</code> ของออบเจ็กต์ <code>yii\web\CookieCollection</code> และกำหนดภาษาที่ต้องการใช้งานในแอพพลิเคชัน Yii2 ด้วยเมธอด <code>setLanguage()</code> ของออบเจ็กต์ <code>yii\web\Application</code></p> </div> </div> </div> </div> </div> </div> <div class="group w-full text-gray-800 dark:text-gray-100 border-b border-black/10 dark:border-gray-900/50 bg-gray-50 dark:bg-[#444654]"> <div class="text-base gap-4 md:gap-6 md:max-w-2xl lg:max-w-xl xl:max-w-3xl p-4 md:py-6 flex lg:px-0 m-auto"> <div class="relative flex w-[calc(100%-50px)] flex-col gap-1 md:gap-3 lg:w-[calc(100%-115px)]"> <div class="flex flex-grow flex-col gap-3"> <div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap"> <div class="markdown prose w-full break-words dark:prose-invert light"> <p>อย่างไรก็ตาม การใช้งาน Cookie หรือ Session ไม่เหมาะสมกับงานที่เกี่ยวข้องกับความปลอดภัยของข้อมูล เนื่องจากข้อมูลจะถูกเก็บไว้ในเครื่องของผู้ใช้ ซึ่งอาจทำให้มีผู้ไม่หวังดีนำข้อมูลไปใช้งานในทางที่ไม่เหมาะสม</p> <p>ดังนั้น ในการออกแบบและพัฒนาระบบที่มีความปลอดภัยสูง ควรใช้วิธีการเก็บข้อมูลที่เป็น Secure Storage เช่น Database หรือ File System แทนการใช้งาน Cookie หรือ Session โดยตรง โดยมีการเข้ารหัสข้อมูลและใช้ Secure Communication เพื่อความปลอดภัยของข้อมูลตลอดจนการส่งผ่านข้อมูลระหว่างเครื่องของผู้ใช้และเซิร์ฟเวอร์</p> </div> </div> </div> </div> </div> </div> <div class="group w-full text-gray-800 dark:text-gray-100 border-b border-black/10 dark:border-gray-900/50 bg-gray-50 dark:bg-[#444654]"> <div class="text-base gap-4 md:gap-6 md:max-w-2xl lg:max-w-xl xl:max-w-3xl p-4 md:py-6 flex lg:px-0 m-auto"> <div class="relative flex w-[calc(100%-50px)] flex-col gap-1 md:gap-3 lg:w-[calc(100%-115px)]"> <div class="flex flex-grow flex-col gap-3"> <div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap"> <div class="markdown prose w-full break-words dark:prose-invert light"> <p>อีกหนึ่งเหตุผลที่ Cookie หรือ Session ไม่เหมาะสมกับงานที่ต้องการให้ผู้ใช้งานสามารถเข้าถึงข้อมูลได้ทุกเครื่อง เนื่องจากข้อมูลจะถูกเก็บไว้ในเครื่องของผู้ใช้งาน และข้อมูลต่าง ๆ ใน Session นั้นไม่สามารถเข้าถึงได้จากเครื่องอื่น ๆ หรือผู้ใช้งานที่ไม่ได้เข้าสู่ระบบเดียวกัน</p> <p>หากต้องการให้ผู้ใช้งานสามารถเข้าถึงข้อมูลได้ทุกเครื่อง สามารถใช้เทคโนโลยีเก็บข้อมูลแบบ Centralized Storage เช่น Database หรือ Cloud Storage แทนการใช้งาน Cookie หรือ Session โดยตรง โดยผู้ใช้งานจะต้องเข้าสู่ระบบด้วยชื่อผู้ใช้และรหัสผ่าน และข้อมูลจะถูกเก็บไว้ในฐานข้อมูลหรือพื้นที่เก็บข้อมูลบน Cloud ซึ่งสามารถเข้าถึงได้จากทุกเครื่องที่ผู้ใช้งานเข้าใช้งานได้ ดังนั้นจึงเหมาะสมกับงานที่ต้องการให้ผู้ใช้งานสามารถเข้าถึงข้อมูลได้ทุกเครื่อง</p> </div> </div> </div> </div> </div> </div> <div class="group w-full text-gray-800 dark:text-gray-100 border-b border-black/10 dark:border-gray-900/50 bg-gray-50 dark:bg-[#444654]"> <div class="text-base gap-4 md:gap-6 md:max-w-2xl lg:max-w-xl xl:max-w-3xl p-4 md:py-6 flex lg:px-0 m-auto"> <div class="relative flex w-[calc(100%-50px)] flex-col gap-1 md:gap-3 lg:w-[calc(100%-115px)]"> <div class="flex flex-grow flex-col gap-3"> <div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap"> <div class="markdown prose w-full break-words dark:prose-invert light"> <p>อีกหนึ่งเหตุผลที่ Cookie หรือ Session ไม่เหมาะสมกับงานที่ต้องการเก็บข้อมูลตลอดเวลาหรือเก็บข้อมูลที่มีอายุการใช้งานยาวนาน คือ Cookie และ Session มีขนาดจำกัดในการเก็บข้อมูล ซึ่งอาจไม่เพียงพอต่อการเก็บข้อมูลที่มีขนาดใหญ่หรืออายุการใช้งานยาวนาน เช่น ข้อมูลสำหรับการเข้าสู่ระบบที่ต้องการใช้งานตลอดเวลา หรือข้อมูลการเข้าใช้งานระบบของผู้ใช้งานที่ต้องการเก็บไว้เพื่อวิเคราะห์และประมวลผลในภายหลัง</p> <p>หากต้องการเก็บข้อมูลตลอดเวลาหรือเก็บข้อมูลที่มีอายุการใช้งานยาวนาน สามารถใช้เทคโนโลยีเก็บข้อมูลแบบ Persistent Storage เช่น Database หรือ File System แทนการใช้งาน Cookie หรือ Session โดยตรง โดยสามารถเก็บข้อมูลได้โดยไม่จำกัดขนาด และมีความยืดหยุ่นในการจัดการข้อมูลให้เหมาะสมกับความต้องการของระบบ ดังนั้นจึงเหมาะสมกับงานที่ต้องการเก็บข้อมูลตลอดเวลาหรือเก็บข้อมูลที่มีอายุการใช้งานยาวนาน</p> </div> </div> </div> </div> </div> </div> <div class="group w-full text-gray-800 dark:text-gray-100 border-b border-black/10 dark:border-gray-900/50 bg-gray-50 dark:bg-[#444654]"> <div class="text-base gap-4 md:gap-6 md:max-w-2xl lg:max-w-xl xl:max-w-3xl p-4 md:py-6 flex lg:px-0 m-auto"> <div class="relative flex w-[calc(100%-50px)] flex-col gap-1 md:gap-3 lg:w-[calc(100%-115px)]"> <div class="flex flex-grow flex-col gap-3"> <div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap"> <div class="markdown prose w-full break-words dark:prose-invert light"> <p>อีกหนึ่งเหตุผลที่ Cookie หรือ Session ไม่เหมาะสมกับงานที่ต้องการความปลอดภัยของข้อมูลสูง คือการเก็บข้อมูลใน Cookie หรือ Session อาจเป็นเป้าหมายของผู้ไม่หวังดีที่ต้องการเข้าถึงข้อมูลที่อยู่ใน Cookie หรือ Session นั้น และอาจเป็นช่องโหว่ในการเข้าถึงข้อมูลสำคัญของผู้ใช้งาน เช่น ข้อมูลการเข้าสู่ระบบ หรือข้อมูลการทำธุรกรรมทางการเงิน ซึ่งอาจเป็นอันตรายต่อความปลอดภัยของผู้ใช้งาน</p> <p>หากต้องการความปลอดภัยของข้อมูลสูง สามารถใช้เทคโนโลยีเข้ารหัส (Encryption) เพื่อเข้ารหัสข้อมูลที่จะเก็บไว้ หรือใช้เทคโนโลยีแบบ Token ซึ่งเป็นการเก็บข้อมูลแบบหมุนเวียน โดยจะมีการสร้าง Token ขึ้นมาเพื่อใช้เป็นตัวบอกตนของผู้ใช้งาน โดยข้อมูลจะถูกเก็บไว้ในฐานข้อมูลหรือพื้นที่เก็บข้อมูลบน Cloud ซึ่งสามารถเข้าถึงได้โดยผู้ใช้งานที่มีสิทธิ์เท่านั้น ดังนั้นจึงเหมาะสมกับงานที่ต้องการความปลอดภัยของข้อมูลสูง</p> </div> </div> </div> </div> </div> </div> <div class="group w-full text-gray-800 dark:text-gray-100 border-b border-black/10 dark:border-gray-900/50 bg-gray-50 dark:bg-[#444654]"> <div class="text-base gap-4 md:gap-6 md:max-w-2xl lg:max-w-xl xl:max-w-3xl p-4 md:py-6 flex lg:px-0 m-auto"> <div class="relative flex w-[calc(100%-50px)] flex-col gap-1 md:gap-3 lg:w-[calc(100%-115px)]"> <div class="flex flex-grow flex-col gap-3"> <div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap"> <div class="markdown prose w-full break-words dark:prose-invert light"> <p>ในการออกแบบระบบเก็บข้อมูลสำหรับงานประเภทที่ต้องการเก็บข้อมูลตลอดเวลาหรือเก็บข้อมูลที่มีอายุการใช้งานยาวนาน และต้องการความปลอดภัยของข้อมูลสูง เราสามารถใช้ฐานข้อมูล (Database) เพื่อเก็บข้อมูลแทน Cookie หรือ Session ได้ ซึ่งฐานข้อมูลจะเป็นส่วนหนึ่งของระบบซอฟต์แวร์ และจะมีการเข้ารหัสข้อมูลเพื่อเพิ่มความปลอดภัย</p> <p>การใช้งานฐานข้อมูลสามารถสร้างขึ้นมาได้ด้วยหลายภาษาโปรแกรมต่างๆ เช่น PHP, Python, Java ฯลฯ โดยใช้ Framework หรือ Library ต่างๆ เช่น Laravel, Django, Spring ฯลฯ ในการเขียนโปรแกรม ซึ่งฐานข้อมูลสามารถเก็บข้อมูลที่มีขนาดใหญ่ และมีความยืดหยุ่นในการจัดการข้อมูลให้เหมาะสมกับความต้องการของระบบ</p> <p>ยกตัวอย่างการใช้งานฐานข้อมูลในงานต่างๆ เช่น ในระบบเว็บไซต์อีคอมเมิร์ซ ฐานข้อมูลจะถูกใช้งานเพื่อเก็บข้อมูลการสั่งซื้อสินค้าของลูกค้า ในระบบเว็บไซต์แชทหรือแอปพลิเคชันการสื่อสาร ฐานข้อมูลจะถูกใช้งานเพื่อเก็บข้อมูลการสนทนาระหว่างผู้ใช้งาน หรือในระบบธุรกรรมทางการเงินธุรกิจ ฐานข้อมูลจะถูกใช้งานเพื่อเก็บข้อมูลการทำธุรกรรมทางการเงินของลูกค้า </p> </div> </div> </div> </div> </div> </div> <div class="group w-full text-gray-800 dark:text-gray-100 border-b border-black/10 dark:border-gray-900/50 dark:bg-gray-800"> <div class="text-base gap-4 md:gap-6 md:max-w-2xl lg:max-w-xl xl:max-w-3xl p-4 md:py-6 flex lg:px-0 m-auto"> <div class="w-[30px] flex flex-col relative items-end"></div> <div class="relative flex w-[calc(100%-50px)] flex-col gap-1 md:gap-3 lg:w-[calc(100%-115px)]"> <div class="flex flex-grow flex-col gap-3"></div> </div> </div> </div> <div class="group w-full text-gray-800 dark:text-gray-100 border-b border-black/10 dark:border-gray-900/50 bg-gray-50 dark:bg-[#444654]"> <div class="text-base gap-4 md:gap-6 md:max-w-2xl lg:max-w-xl xl:max-w-3xl p-4 md:py-6 flex lg:px-0 m-auto"> <div class="relative flex w-[calc(100%-50px)] flex-col gap-1 md:gap-3 lg:w-[calc(100%-115px)]"> <div class="flex flex-grow flex-col gap-3"> <div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap"> <div class="markdown prose w-full break-words dark:prose-invert light"> <p></p> </div> </div> </div> </div> </div> </div>
Content Short
Content Short
Content Img Alt
Content Tag
อัพโหลดรูปภาพ
สำหรับ SEO
Meta Title
Meta Desc
Meta Keyword
Og Title
Og Desc
สถานะเปิดใช้งานบทความ
Save
Back home