2
ฉันควรใช้ spl_autoload_register () ในปลั๊กอินของฉันหรือไม่
เมื่อฉันใช้ spl_autoload_register ในปลั๊กอินของฉันฉันจะได้รับ: Fatal error: Uncaught exception 'LogicException' with message 'Class wp_atom_server could not be loaded' wp-includes\pluggable-deprecated.php on line 182 ฉันอ่านและพบการแก้ไขต่าง ๆ หนึ่งในนั้นบอกว่าจะไม่ใช้ spl_autoload_register กับ WordPress ถูกต้องหรือไม่ ฉันแน่ใจว่าฉันสามารถหา "แก้ไข" สำหรับข้อผิดพลาด แต่ฉันไม่แน่ใจว่าฉันต้องการทำเช่นนั้นกับการเปิดตัว WP แต่ละครั้ง หากฉันไม่ได้ใช้ฟังก์ชั่น autoload ฉันจะโหลดคลาสได้อย่างไร? นี่คือสิ่งที่แบ่งตอนนี้: spl_autoload_extensions(".php"); spl_autoload_register(); use MyPluginClasses\Student as MS; $student = new MS\Student(); echo $student->sayHello(); ในนักเรียน: …