(PHP 5 >= 5.3.0, PHP 7)
ReflectionClass::inNamespace — 锟斤拷锟斤拷欠锟轿伙拷锟斤拷锟斤拷锟斤拷占锟斤拷锟�
锟斤拷锟斤拷锟斤拷锟斤拷锟角凤拷锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷锟秸硷拷锟斤拷锟斤。
锟剿猴拷锟斤拷没锟叫诧拷锟斤拷锟斤拷
锟缴癸拷时锟斤拷锟斤拷 TRUE
锟斤拷 锟斤拷锟斤拷锟斤拷失锟斤拷时锟斤拷锟斤拷 FALSE
锟斤拷
Example #1 ReflectionClass::inNamespace() 锟斤拷锟斤拷
<?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"