我的目录结构式这样的
/Class/A.php
/Class/B.php
/Class/C.php
/App/sample/index.php
我想在index.php动态实例化Class里面的哪些类,index.php是这样的
$className = "";
$obj = new $className();
className我应该怎么写?
要是index在根目录估计可以直接new一个namespace+className变量,但这样都不在根目录不知道怎么表示上一级目录或者根目录了。
谢谢
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
$_SERVER['DOCUMENT_ROOT']