หากเกิดข้อความเตือนเมื่อเรียกคำสั่ง php แบบ cli (Command line) เช่น
$ /usr/bin/php –help PHP Warning: PHP Startup: memcache: Unable to initialize module Module compiled with module API=20050922, debug=0, thread-safety=0 PHP compiled with module API=20060613, debug=0, thread-safety=0 These options need to match in Unknown on line 0 …
สามารถแก้ปัญหาโดยการใช้ option -n ซึ่งหมายถึง php จะไม่ไปอ่านค่าต่างๆ ในไฟล์ php.ini ตัวอย่างการใช้งานเช่น
$ /usr/bin/php [...]
Object-relational mapping (ORM, O/RM, and O/R mapping) in computer software is a programming technique for converting data between incompatible type systems in relational databases and object-oriented programming languages.
From: http://en.wikipedia.org/wiki/Object-relational_mapping
หากมีเวลาก็ทดลองใช้งาน ORM ต่างๆ ได้
DataMapper OverZealous Edition (DMZ) Doctrine (CodeIgniter and Doctrin Tutorial) RapidDataMapper
ผมใช้ CodeIginter แล้วเจอ error เกี่ยวกับ session library แบบนี้
A PHP Error was encountered Severity: 4096 Message: Object of class stdClass could not be converted to string Filename: libraries/Session.php Line Number: 715
ลองค้นดูในเน็ตแล้วพบว่าเป็นบั๊กของ session เกี่ยวกับ object storage วิธีการแก้ที่
http://codeigniter.com/forums/viewthread/95690/P0/
โดยให้แก้ไฟล์ system/libraries/Session.php ที่บรรทัด 683 และ 714 จาก
$data[$key] = str_replace(‘\’, ‘{{slash}}’, $val);
ให้่เป็น
if(!is_object($val)) $data[$key] = str_replace(‘{{slash}}’, ’\', $val);
PHP:
$iphone = strpos($_SERVER['HTTP_USER_AGENT'], ‘iPhone’); $ipod = strpos($_SERVER['HTTP_USER_AGENT'], ‘iPod’); if($iphone || $ipod){ header(‘Location: http://m.example.com/’); }
JavaScript:
if((navigator.userAgent.indexOf(‘iPhone’) != -1) || (navigator.userAgent.indexOf(‘iPod’) != -1)){ document.location = “http://m.example.com/”; }
ที่มา: http://eugen.io/2009/12/setting-up-your-web-site-to-run-on-iphone-browser/
Codeiginer มี pagination class เพื่อช่วยในการจัดแบ่งข้อมูลที่จะนำแสดงบนเว็บ โดยผู้ใช้สามารถกำหนดได้ว่าในแต่ละหน้านั้น จะให้แสดงจำนวนข้อมูลจำนวนเท่าใด โดยจะมีการทำลิ้งก์ให้เลือกหน้าถัดไปหรือย้อนหลังให้อัตโนมัติ เช่น
ตัวอย่างการใช้งาน
$this->load->library(‘pagination’); $config['base_url'] = ‘http://example.com/index.php/test/page/’; $config['total_rows'] = ’200′; $config['per_page'] = ’20′; $this->pagination->initialize($config); echo $this->pagination->create_links();
องค์ประกอบเบื้องต้น
ตัวแปร $config จากตัวอย่างข้างต้น ใช้ในการกำหนดองค์ประกอบที่ต้องการ โดยสามารถสร้างไฟล์สำหรับเก็บตัวแปร $config ชื่อ pagination.php แยกไว้ต่างหาก [...]
Tags
.htaccess Apache blogspot CentOS codeigniter CSS domain name driver Drupal Flickr Hotmail HTML internet law linux Mac OS X mailing list mailman MICT mod_rewrite monitor MSL MySQL name server Network PHP Postfix Security Smarty sony Spammail SPF theme TLS traffic log Universiade UTF-8 UTF8 vbulletin Wordpress การเมือง จตุคาม รูปภาพ สถิติ เรารักในหลวง
