Skip to content

Purpose ​

Many flows need a short message and an automatic redirect (success or error). PhpTide provides ok_jump() and err_jump() for that pattern.

Example ​

Login flow:

php
<?php 
namespace home\controller;

class index{
    public function login(){
        $data = gp('user_name,user_password');
        $user = m('user')->where($data)->find();
        if (empty($user)) {
            err_jump('User not found');
        } else {
            ok_jump('Signed in','/home/index/dashboard');
        }
    }
}

Parameters ​

ok_jump and err_jump share the same signature. Using ok_jump as reference:

ok_jump($msg, $url, $param, $second)

  • $msg — Message shown during the redirect.
  • $url — Two styles:
    • Framework path /module/controller/action (example current module: home):
      • /home/index/dashboard
      • index/dashboard → /home/index/dashboard (leading / fills current module)
      • dashboard → /home/index/dashboard (no leading slash fills module + controller)
    • Full URL, e.g. https://example.com
  • $param — Extra query string such as ?uid=1
  • $second — Delay in seconds before redirect

Typical uses ​

These helpers fit login, form posts, permission failures, and “saved successfully” feedback pages.

PhpTide documentation