class Google_Model_SomeThing { ... }
$className = 'google_MODEL_something';
我可以在$ className上创建类的实例。但是如果我想从$ className中获取正确的案例类名而不创建实例呢?PHP如何获取正确的案例类名称
我希望这样的事情:
echo func('google_MODEL_something'); // Google_Model_SomeThing
或
$className = 'google_MODEL_something';
echo $className::class; // Google_Model_SomeThing
这里http://stackoverflow.com/questions/5260168/capital-letters-in-class-name-php。 PHP在类命名中不敏感。 –
就像我在我的问题中指出:我可以创建实例 - 使用类名时PHP不区分大小写。但如何获得正确的案例类名称? – l00k
这取决于你想从哪里得到它? –