所以我得到了这个源代码
//get activated bundles
$bundle_list = new AutoRouter('dev',true);
$bundle_list = $bundle_list->getActivatedBundles();
for($a =0; $a < sizeof($bundle_list); $a++)
{
var_dump($bundle_list[$a]);
}
转储返回多个类似这样的对象。
object(Symfony\Bundle\FrameworkBundle\FrameworkBundle)[38]
protected 'name' => null
protected 'extension' => null
protected 'path' => null
protected 'container' => null
object(Symfony\Bundle\SecurityBundle\SecurityBundle)[41]
protected 'name' => null
protected 'extension' => null
protected 'path' => null
protected 'container' => null
object(Symfony\Bundle\TwigBundle\TwigBundle)[40]
protected 'name' => null
protected 'extension' => null
protected 'path' => null
protected 'container' => null
我需要提取对象名称作为字符串,就像这样:
(string) "Symfony\Bundle\FrameworkBundle\FrameworkBundle"
(string) "Symfony\Bundle\SecurityBundle\SecurityBundle"
(string) "Symfony\Bundle\TwigBundle\TwigBundle"
类似于
for($a =0; $a < sizeof($bundle_list); $a++)
{
var_dump((string) $bundle_list[$a]);
}
get_class()
吗?参考文档:http://php.net/manual/zh/function.get-class.php - undefined