UTF-8 เป็นคำตอบสุดท้่าย เพื่อให้การใช้ภาษาไทยกับ PHP และ MySQL ใช้งานได้อย่างสมบูรณ์
การสร้างฐานข้อมูลใน MySQL
ให้ตั้งค่าดังต่อไปนี้
Default CHARSET = utf8 COLLATE = utf8_unicode_ci
ตัวอย่างเช่น
CREATE TABLE brand ( pk_brand int(5) NOT NULL auto_increment, brand varchar(250) collate utf8_unicode_ci NOT NULL, brand_logo varchar(200) collate utf8_unicode_ci NOT NULL, website varchar(200) collate utf8_unicode_ci default NULL, PRIMARY KEY (pk_brand) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
แล้วทำไมจึงไม่ใช้ utf8_general_ci? [...]
ผมบังเิอิญไปเจอวิธีการที่จะเรียก Smarty library ที่น่าสนใจ สะดวกมากเวลาที่กำลังพัฒนาโปรแกรม เพราะไม่ต้องระบุ path เลย แต่เมื่อพัฒนาโปรแกรมเสร็จแล้วก็ควรแก้ไข path ให้ถูกต้องครับ
<?php // SMARTY Section define(‘SMARTY_DIR’,str_replace(“\”,”/”,getcwd()).’/Smarty-2.6.19/libs/’); require_once(SMARTY_DIR . ‘Smarty.class.php’); $smarty = new Smarty(); $smarty->template_dir = str_replace(“\”,”/”,getcwd()).’/templates/’; $smarty->compile_dir = str_replace(“\”,”/”,getcwd()).’/templates_c/’; $smarty->config_dir = str_replace(“\”,”/”,getcwd()).’/configs/’; $smarty->cache_dir = str_replace(“\”,”/”,getcwd()).’/cache/’; //** un-comment the following line to show the debug console //$smarty->debugging = true; ?>
ผมลองค้นหา CSS ที่ใช้ร่วมกับ <pre> tag เพื่อนำมาใช้แสดงโค้ดของโปรแกรม ก็บังเอิญได้พบ CSS ที่ใช้แสดงผลดังนี้
.phpcode, pre { overflow: auto; padding-left: 15px; padding-right: 15px; font-size: 11px; line-height: 15px; margin-top: 10px; width: 93%; display: block; background-color: #eeeeee; color: #000000; max-height: 300px; }
เราสามารถกำหนด white-space: pre; ให้กับแต่ละ element ได้เช่นกัน ดังตัวอย่างต่อไปนี้
.preElement{ white-space: pre; font-weight: bold; color: navy; font-family: arial; }
และสามารถกำหนดฟอนต์ให้กับ <pre> แท็กดังนี้
[...]
PEAR มีแพ็คเกจที่ชื่อว่า Auth ซึ่งช่วยอำนวยความสะดวกในการสร้างระบบตรวจสอบสิทธิ์ผู้ใช้ (authentication) โดยช่วยอำนวยความสะดวกตั้งแต่ การเพิ่มและลบผู้ใช้ การล็อกอิน การนำข้อมูลผู้ใช้มาแสดง การกำหนดระยะเวลาการล็อกอินและ Idle timeout และการตรวจสอบสิทธิ์ผู้ใช้งาน ทำให้ช่วยลดเวลาในการพัฒนาโปรแกรมลงได้มาก
สิ่งที่สำคัญคือ Auth รองรับระบบจัดเก็บข้อมูลของผู้ใช้หลากหลายประเภท ได้แก่
All databases supported by the PEAR database layer All databases supported by the MDB database layer All databases supported by the MDB2 database layer Plaintext files LDAP servers POP3 [...]
Tags
.htaccess Apache blogspot CentOS codeigniter CSS domain name driver Drupal Flickr Hotmail HTML internet law linux mailing list mailman MICT mod_rewrite monitor MSL MySQL name server Network open source PHP Postfix Security Smarty sony Spammail SPF theme TLS traffic log Universiade UTF-8 UTF8 vbulletin Wordpress การเมือง จตุคาม รูปภาพ สถิติ เรารักในหลวง
