GithubHelp home page GithubHelp logo

jump's Introduction

Jump

🚀 🔥 🌈 基于webman使用 KingBes/Jump 包实现的页面跳转解决方案

页面跳转 composer

composer require kingbes/jump

必须安装视图拓展哦~~~

https://www.workerman.net/doc/webman/view.html

返回成功页面

use Kingbes\Jump\Jump; //引入

class IndexController extends Jump
{
    public function index(Request $request)
    {
        // @param mixed $msg — 提示信息
        // @param string $url — 跳转的URL地址
        // @param mixed $data — 返回的数据
        // @param integer $wait — 跳转等待时间
        // @param array $header — 发送的Header信息
        return $this->success("ok"); //返回成功页面
    }
}

alt 成功页面 ajax请求则返回json

返回失败页面

use Kingbes\Jump\Jump; //引入

class IndexController extends Jump
{
    public function index(Request $request)
    {
        // @param mixed $msg — 提示信息
        // @param string $url — 跳转的URL地址
        // @param mixed $data — 返回的数据
        // @param integer $wait — 跳转等待时间
        // @param array $header — 发送的Header信息
        return $this->error("no"); //返回失败页面
    }
}

alt 失败页面 ajax请求则返回json

返回API数据到客户端

use Kingbes\Jump\Jump; //引入

class IndexController extends Jump
{
    public function index(Request $request)
    {
        // @param array $data — 要返回的数据
        // @param integer $code — 返回的code
        // @param string $msg — 提示信息
        // @param array $header — 发送的Header信息
        return $this->result(["name" => "webman"]); //返回json
    }
}

结果

{
    "code": 1,
    "msg": "",
    "time": 1706349439,
    "data": {
        "name": "webman"
    }
}

自定义返回模板,配置config/plugin/kingbes/jump/app.php

<?php
return [
    'enable' => true,
    'jump' => BASE_PATH . '/vendor/kingbes/jump/src/jump.html' // 配置模板
];

jump's People

Contributors

kingbes avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.