# tp-jump **Repository Path**: wycto/tp-jump ## Basic Information - **Project Name**: tp-jump - **Description**: 适用于thinkphp的跳转扩展,支持tp6.0, tp8.0 - **Primary Language**: PHP - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-08-16 - **Last Updated**: 2023-11-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ![](http://www.wycto.cn/static/img/logo.png) # [gitee仓库](https://gitee.com/wycto/tp-jump) # tp-jump 适用于thinkphp的跳转扩展 ## 安装 ~~~php //默认thinkphp8 php8 composer require wycto/tp-jump thinkphp 6.0 composer require wycto/tp-jump:^6.0 ~~~ ## 配置 ~~~php // 安装之后会在config目录里生成jump.php配置文件 return[ // 默认跳转页面对应的模板文件 'success_tpl' => app()->getRootPath().'/vendor/wycto/tp-jump/src/tpl/success.tpl', 'error_tpl' => app()->getRootPath().'/vendor/wycto/tp-jump/src/tpl/error.tpl', 'jsonMethod' => ['POST'] //哪些请求类型返回json格式 ]; ~~~ ## 用法示例 使用 use wycto\tp-jump\Jump; 在所需控制器内引用该扩展即可: ~~~php error('失败','data数据',['username' => 'wycto', 'sex' => '男']); //return $this->success('成功','data数据',['username' => 'wycto', 'sex' => '男'],'index/index'); //return $this->redirect('/admin/index/index',302); //return $this->json(200,'ok','token',['name'=>'占三'],$header = []); return $this->result(200,'成功',['username' => 'wycto', 'sex' => '男']); } } ~~~