common.php 649 B

1234567891011121314151617181920212223242526
  1. <?php
  2. // 应用公共文件
  3. function jump($msg = '', $url = null, $wait = 3)
  4. {
  5. if (is_null($url)) {
  6. $url = 'javascript:history.back(-1);';
  7. } else {
  8. $url = "location.href = '" . url($url) . "'";
  9. }
  10. $result = [
  11. 'msg' => $msg,
  12. 'url' => $url,
  13. 'wait' => $wait,
  14. ];
  15. $html = view('/public/jump', $result);
  16. throw new \think\exception\HttpResponseException($html);
  17. }
  18. function ajax_success($data)
  19. {
  20. $res = ['code' => 0, 'msg' => '成功', 'data' => $data];
  21. $response = \think\Response::create($res, 'json');
  22. throw new \think\exception\HttpResponseException($response);
  23. }