wycto/tp-jump

适用于thinkphp的跳转扩展

Maintainers

Details

github.com/wycto/tp-jump

Source

Issues

Installs: 11

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:think-extend

v8.0.2 2023-08-20 12:06 UTC

This package is not auto-updated.

Last update: 2024-10-30 12:11:54 UTC


README

gitee仓库

tp-jump

适用于thinkphp的跳转扩展

安装

//默认thinkphp8 php8
composer require wycto/tp-jump

thinkphp 6.0
composer require wycto/tp-jump:^6.0

配置

// 安装之后会在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
namespace app\controller;

class Index 
{
    use \wycto\jump\Jump; 
    public function index()
    {
        //return $this->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' => '']);  
    }
}