欢迎各位兄弟 发布技术文章
这里的技术是共享的
样例:
<?php
/**
* @file
* Contains \Drupal\Subsystem\Foo.
*/
namespace Drupal\Subsystem;
// This imports just the Cat class from the Drupal\Othersystem namespace.
// 仅仅导入Drupal\Othersystem命名空间里的Cat类
use Drupal\Othersystem\Cat;
// Bar is a class in the Drupal\Subsystem namespace in another file.
// It is already available without any importing.
// Bar是另一个文件里的类,也属于Drupal\Subsystem命名空间
/**
* Defines a Foo.
* 定义一个东西。
*/
class Foo {
/**
* Constructs a new Foo object.
* Foo对象的构造函数
*/
public function __construct(Bar $b, Cat $c) {
// Global classes must be prefixed with a \ character.
// 在命名空间中使用全局类,必须在类名前面使用反斜杠。
$d = new \DateTime();
}
}
?>
来自 http://drupalchina.cn/book/export/html/1943
请问InvalidArgumentException前面的“\”是怎么回事?
最佳答案: 这个是命名空间吧,5.3+才支持呢
来自 http://wapiknow.baidu.com/question/513703881.html
http://zhidao.baidu.com/question/513703881.html