Warning: date() [function.date]: It is not safe to rely on the system's timezone settings.
You are *required* to use the date.timezone setting or the date_default_timezone_set() function.
In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier.
We selected 'Asia/Krasnoyarsk' for '7.0/no DST' instead in ...
วิธีแก้ไข
<?php
date_default_timezone_set('Asia/Bangkok');
?>
ฟังก์ชัน date_default_timezone_set()
การใช้ฟังก์ชัน date_default_timezone_set() เพื่อตั้งค่า timezone
ตัวอย่างเช่น timezone
America/Los_Angeles
America/New_York
America/Sao_Paulo
Asia/Tokyo
Asia/Bangkok
รับเขียนโปรแกรมธุรกิจ SMEs ทุกประเภท เว็บไซต์ เว็บบล็อก AppWebBlog@gmail.com : O8-4511-9515
แสดงบทความที่มีป้ายกำกับ ความรู้PHP แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ ความรู้PHP แสดงบทความทั้งหมด
php 5.3 setcookie Warning: Cannot modify header information - headers already sent by .. แก้โดย บรรทัดที่ 1 วาง
ปัญหากวนใจเรื่องการเขียนเว็บไซต์ด้วยภาษา PHP 5.3 ยังมีเรื่องอีกอย่างที่ทำให้ต้องหาทางแก้ไข ซึ่งที่ผมเจอจะเป็นช่วงหน้า login ที่ต้องการส่งค่าที่ต้องการบางอย่างไปเก็บไว้ใน setcookie เพื่อเอาไว้ใช้งาน ทำให้เกิด ข้อความว่า
"Warning: Cannot modify header information - headers already sent by"
ขึ้นมาเลยหาข้อมูลวิธีแก้ไขและไปเจอเว็บเพจที่น่าสนใจเกี่ยวกับปัญหานี้ (http://stackoverflow.com/questions/8028957/how-to-fix-headers-already-sent-error-in-php)
ลองอ่านดูนะครับ แต่ผมลองวางโค้ดแค่นี้ที่บรรทัดที่ 1 ของหน้าโค้ด คือ
<?php ob_start() ;?>
PHP 5.3 ทำไม Uncaught ReferenceError: ClearData is not defined ?
login_ok.php:18 Uncaught ReferenceError: ClearData is not defined
วันนี้เจอBug เกี่ยวกับ datetime ของ PHP 5.3 แสดงว่า "login_ok.php:18 Uncaught ReferenceError: ClearData is not defined" ดูที่โค้ดเขียนไว้ว่า
$date = date("Y-m-d H:i:s");
ให้แก้เป็น
$original_timezone = new DateTimeZone('UTC');
// Instantiate the DateTime object, setting it's date, time and time zone.
$datetime = new DateTime($original_datetime, $original_timezone);
// Set the DateTime object's time zone to convert the time appropriately.
$target_timezone = new DateTimeZone('Asia/Bangkok');
$datetime->setTimeZone($target_timezone);
// Outputs a date/time string based on the time zone you've set on the object.
$triggerOn = $datetime->format('Y-m-d H:i:s');
$date =$triggerOn;
จบ...
PHP : php.ini คืออะไร? ปรับแก้ยังไงให้ใช้งานได้ดีกับ server
ข้อมูลสรุปนี้ไม่พร้อมใช้งาน โปรด
คลิกที่นี่เพื่อดูโพสต์
สมัครสมาชิก:
บทความ (Atom)