选择语言 :

 Core_View::get_tag

获取指定key的Tag

array Core_View::get_tag( string $keystr )

参数列表

参数 类型 描述 默认值
$keystr string $keystr
返回值
  • array
File: ./core/classes/view.class.php
public static function get_tag($keystr)
{
    # 判断是否调试输出
    if (null===_view_tag_current::$debug)
    {
        _view_tag_current::$debug = (IS_DEBUG && Core::debug()->profiler('view_tag')->is_open())?true:false;
    }

    if (_view_tag_current::$debug)
    {
        # 如果是调试输出,则直接构造出对象
        $data = array
        (
            new _view_tag_current($keystr,null),
       );
        return $data;
    }

    # 获取所有视图TAG
    static $tags = null;
    if (null===$tags)
    {
        $tags = Core::config('view.tags');
        if (!$tags || !is_array($tags))$tags = array();
        foreach ($tags as & $tag)
        {
            if (!is_array($tag))$tag = array($tag);
        }
    }

    if (isset($tags[$keystr]))
    {
        $data = array();
        foreach ($tags[$keystr] as $item)
        {
            $data[] = new _view_tag_current($keystr,$item);
        }

        return $data;
    }
    else
    {
        return array();
    }
}