PHPackages                             hahadu/think-jump-class - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. hahadu/think-jump-class

ActiveThink-extend[Utility &amp; Helpers](/categories/utility)

hahadu/think-jump-class
=======================

基于thinkphp6的页面跳转模块

v3.2.0(5y ago)21513Apache-2.0PHPPHP &gt;=7.1

Since Sep 29Pushed 5y ago1 watchersCompare

[ Source](https://github.com/hahadu/think-jump-class)[ Packagist](https://packagist.org/packages/hahadu/think-jump-class)[ RSS](/packages/hahadu-think-jump-class/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (1)Versions (21)Used By (3)

think-jump-class
================

[](#think-jump-class)

基于thinkphp6的页面跳转模块

安装：composer require hahadu/think-jump-class

- 支持自定义状态码
- 支持layer弹窗自动关闭
- 兼容tp旧版本的跳转写法（$this-&gt;success）

### 更新：

[](#更新)

#### 11.10更新：

[](#1110更新)

- 新增ajax返回
- 修复配置模板文件无效
- 新增快捷函数jump\_page();

#### 10.15更新：

[](#1015更新)

- V3.0版
- - 1、新增：自定义http\_response\_code
- - 2、新增：自定义title
- - 3、新增：Exception
- - 4、修复：mysql保留关键字冲突

### 使用：

[](#使用)

```
$code = 1;
return \Hahadu\ThinkJumpPage\JumpPage::jumpPage($code,'/index',3);
```

或者：

```
return \Hahadu\ThinkJumpPage\JumpPage::jumpPage($code,$url,$wait_second)->send();
```

或者使用快捷函数

```
jump_page($code);
//或者jump_page($code)->send();
```

jumpPage()有三个参数

第一个参数是页面状态码

第二个参数是跳转的URL,为空默认为默认应用的url,如果是站内跳转的默认跳转回上一页

第三个参数是等待时间（秒），默认为’wait\_second‘的值

### 配置

[](#配置)

##### 自定义跳转模板

[](#自定义跳转模板)

- 自定义跳转模板文件：comopser安装后会自动在config生成一个jumpPage.php的配置文件
- 或者复制src/config目录下jumpPage.php到应用目录下
- 修改JumpPage中的'dispatch\_tpl'值为你的配置文件路径即可

##### 配置ajax

[](#配置ajax)

```
      //是否开启ajax返回 true 开启/ false关闭
      'ajax'=>true,
      //支持json|jsonp|xml3种类型、开启ajax有效
      'ajax_type'=> 'json',
```

##### 完整的配置文件

[](#完整的配置文件)

```
