Strict Standards: Non-static method ... should not be called sta

ข้อผิดพลาดนี้เกิดจากการเรียกใช้งาน class แบบ static ไปยัง class ที่ไม่ใช่ static ครับ

งงใช่มั้ย ไปดูตัวอย่างกันเลย
class gcms {
    public function functionName() {
    }
}

โค้ดด้านบน เป็น class gcms ที่สร้างไว้ครับ และเรียกใช้ class แบบนี้
$result = gcms::functionName();

จะเกิด Error Strict Standards: Non-static method ... should not be called statically in ... on line ...
class gcms {
    public static function functionName() {
    }
}

การแก้ไขให้ใส่คีย์เวอร์ด static ลงไปในชื่อฟังก์ชั่นด้วยครับ แค่นี้ก็หายแล้ว
ผู้เขียน goragod โพสต์เมื่อ 24 ม.ค. 2558 เปิดดู 4,081 ป้ายกำกับ PHPNotice
^