多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
## 切换栏(必须) > 图片演示: ![](https://img.kancloud.cn/40/b7/40b7335472ba491c2e3f469f86d392a0_1623x467.png) > 说明: 设置左上角tab切换栏。 该方法有两个参数`tab($code,$title='')` * 参数 **code** (必须) * 类型一:callable 闭包 设置切换栏的键值对,例: ```php tab(function(){ return [ "base"=>"基础", "other"=>"其他" ]; }); ``` * 类型二:array 设置切换栏的键值对,例: ```php tab([ "base"=>"基础", "other"=>"其他" ]); ``` * 类型三:string|number 设置切换栏key值,配合参数 **title** 使用,例: ```php tab("base","基础")->tab("other","其他"); ``` * 参数 **title** (可选) 设置切换栏key值对应的标题,当参数 **code** 为 string|number 类型时必须 > 示例: 设置选项组为图中演示示例,分别对应的key值为`base=>基础`、`other=>其他` * 方法一 ~~~ $builder=YF('general_example')->tab(function(){ return [ "base"=>"基础", "other"=>"其他" ]; }) ~~~ * 方法二 ~~~ $builder=YF('general_example')->tab([ ‘base’=>'基础', 'other'=>'其他' ]) ~~~ * 方法三 ~~~ $builder=YF('general_example')->tab('base','基础')->tab('other','其他') ~~~