Derived class defined later in the same file “does not exist”?
问题 Let’s suppose we’ve got two php files, a.php and b.php Here’s content of file a.php: <?php // content of a.php class A { } And here’s the content of file b.php <?php // content of b.php include dirname(__FILE__) . "/a.php"; echo "A: ", class_exists("A") ? "exists" : "doesn’t exist", "\n"; echo "B: ", class_exists("B") ? "exists" : "doesn’t exist", "\n"; echo "BA (before): ", class_exists("BA") ? "exists" : "doesn’t exist", "\n"; echo "BB: ", class_exists("BB") ? "exists" : "doesn’t exist", "