定义子命名空间

与目录和文件的关系很象, PHP 命名空间也允许指定层次化的命名空间的名称。

<?php

namespace Foo\Bar;

class Baz
{
    //
}

/**
 * Return the name of the current namespace.
 *
 * @param  void
 * @return string
 */
function baz(): string
{
    return __NAMESPACE__;
}

const BAZ = __NAMESPACE__;

results matching ""

    No results matching ""