1. Go to this page and download the library: Download xvv/think-jump library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
xvv / think-jump example snippets
namespace app\controller;
use xvv\think\Jump;
class Index extends BaseController
{
use Jump;
public function index()
{
// 操作成功,跳转到首页
$this->success('登录成功', '/index/home');
// 操作失败,返回上一页
$this->error('用户名或密码错误');
// AJAX 请求成功
$this->success('保存成功', null, ['id' => 100]);
// 直接重定向
$this->redirect('/user/profile');
// API 接口返回
$this->result(['list' => []], 0, '查询成功');
}
}