Doc #78659 [Opn]: 导入全局类

From: Date: Thu, 10 Oct 2019 08:16:04 +0000
Subject: Doc #78659 [Opn]: 导入全局类
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-16999@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78659&edit=1 ID: 78659 User updated by: 513335394 at qq dot com Reported by: 513335394 at qq dot com Summary: 导入全局类 Status: Open Type: Documentation Problem Package: PHP Language Specification Operating System: liunx PHP Version: 7.3.10 Block user comment: N Private report: N New Comment: use ArrayObject; 和 use \ArrayObject; 应该使用哪一个? Previous Comments: ------------------------------------------------------------------------ [2019-10-10 08:09:52] 513335394 at qq dot com Description: ------------ --- From manual page: https://php.net/language.namespaces.importing --- $a = new ArrayObject(array(1)); // 实例化 ArrayObject 对象 // 如果不使用 "use \ArrayObject" ,则实例化一个 foo\ArrayObject 对象 Test script: --------------- use \ArrayObject use ArrayObject 都能引入全局类 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78659&edit=1

« previous php.doc.bugs (#16999) next »