每天laravel-20160805| Container -8
2016-05-13 09:11
316 查看
/** * Assign a set of tags to a given binding. * * @param array|string $abstracts * @param array|mixed ...$tags * @return void */ public function tag($abstracts, $tags) {// Assign a set of tags to a given binding. $tags = is_array($tags) ? $tags : array_slice(func_get_args(), 1); // get the first args foreach ($tags as $tag) {// foreach $tags to $tag if (! isset($this->tags[$tag])) { $this->tags[$tag] = []; }// check it is set, so set it like init it. foreach ((array) $abstracts as $abstract) { $this->tags[$tag][] = $this->normalize($abstract); }// if the abstracts is array, we ge we want insert into the array. } }// the function has two parameter one is tag another is abstracts // so last we set the $this->tags, bay tags and abstracts /** * Resolve all of the bindings for a given tag. * * @param string $tag * @return array */ public function tagged($tag)// like get all the callback binding for a given tag. { $results = [];// set a store by array if (isset($this->tags[$tag])) {// i know why set the tag by tag function foreach ($this->tags[$tag] as $abstract) {// get the abstract $results[] = $this->make($abstract);// this->make the function like function. } } return $results;// return store array }
相关文章推荐
- PHP正则数组
- PHP基础函数应用
- php用户登录之cookie信息安全分析
- GetPrivateProfile系列函数
- PHP正则表达式收集
- PHP获取URL
- Yii 2.0鉴权之访问控制过滤器(Yii2.0 Authorization By ACF)
- 关于Laravel的二、三事(1)简单的路由
- PHP注册页面实现
- ThinkPHP查询数据与CURD
- PHP实战之WEB计算器
- PHP生成可点击刷新的验证码简单示例
- PHP简单实现无限级分类的方法
- PHP将MySQL的查询结果转换为数组并用where拼接的示例
- php实现在线通讯录功能(附源码)
- php短信接口代码
- PHP问题 —— undefined function mb_convert_encoding
- PHP问题 —— Warning: PHP Startup: Unable to load dyna
- PHP问题 —— Deprecated: Function ereg_replace() is de
- java与php在web开发方面的区别