ReflectionClass::getName

(PHP 5, PHP 7)

ReflectionClass::getName锟斤拷取锟斤拷锟斤拷

说锟斤拷

public ReflectionClass::getName ( void ) : string

锟斤拷取锟斤拷锟斤拷锟斤拷啤锟�

Warning

锟斤拷锟斤拷锟斤拷锟斤拷未锟斤拷写锟侥碉拷锟斤拷锟斤拷锟叫诧拷锟斤拷锟叫憋拷

锟斤拷锟斤拷

锟剿猴拷锟斤拷没锟叫诧拷锟斤拷锟斤拷

锟斤拷锟斤拷值

The class name.

锟斤拷锟斤拷

Example #1 ReflectionClass::getName() 锟斤拷锟斤拷

<?php
namespace A\B;

class 
Foo { }

$function = new \ReflectionClass('stdClass');

var_dump($function->inNamespace());
var_dump($function->getName());
var_dump($function->getNamespaceName());
var_dump($function->getShortName());

$function = new \ReflectionClass('A\\B\\Foo');

var_dump($function->inNamespace());
var_dump($function->getName());
var_dump($function->getNamespaceName());
var_dump($function->getShortName());
?>

锟斤拷锟斤拷锟斤拷锟教伙拷锟斤拷锟斤拷锟�

bool(false)
string(8) "stdClass"
string(0) ""
string(8) "stdClass"

bool(true)
string(7) "A\B\Foo"
string(3) "A\B"
string(3) "Foo"

锟轿硷拷