V5.1.3版本主要改进了路由及调整函数加载顺序,推荐更新,主要更新如下: 5.1版本可以直接使用 composer update topthink/framework 无缝升级到最新版本。 本次更新虽然不多,但都是比较给力的功能,现在你可以直接在配置文件中使用助手函数或者自定义函数了 Route::rule('hello/:name/','index/hello'); Route::rule('hello/:name','index/hello'); 将被视为两个不同的路由,如果需要不区分最后的斜杆,可以这样定义: Route::rule('hello/:name','index/hello')->removeSlash(); view_filter行为钩子取消,你可以用下面的方法进行视图内容输出过滤: $this->filter(function($content){
return str_replace("\r\n",'<br/>',$content);
})->fetch(); 如果使用view助手函数的话,则使用: view()->filter(function($content){
return str_replace("\r\n",'<br/>',$content);
}); Session类的get方法支持无限级的获取,例如: Session::set('a.b',['c'=>1,'d'=>2]);
echo Session::get('a.b.c'); // 输出 1 Request类的only方法支持批量设置默认值,例如: Request::only(['name'=>'','id'=>0]); |