tp5页面跳转重定向

三、页面跳转

1、方法存在的文件路径

  TP5\thinkphp\library\traits\controller\Jump.php

  成功跳转  $this->success();

  失败跳转  $this->error();

2、以登录功能为例:

3、成功和失败页面的文件路径配置  application/config.php

  // 默认跳转页面对应的模板文件

  'dispatch_success_tmpl'  => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl',  

  'dispatch_error_tmpl'    => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl',

扫描二维码关注公众号,回复: 2550295 查看本文章

  模板文件的路径:thinkphp\tpl\dispatch_jump.tpl

  也可以自己指定模板,然后自己设计就可以

  'dispatch_success_tmpl'  => THINK_PATH . 'tpl' . DS . 'success.tpl',

  'dispatch_error_tmpl'    => THINK_PATH . 'tpl' . DS . 'error.tpl',、

四、重定向

五、空模块、空控制器、空方法

  对于url中的恶意输入

  1、空模块:在application/route.php添加

  全局MISS路由
  '__miss__' => ['index/Index/index', ['method'=> 'get']],

  2、空控制器  新建Error控制器

    

  3、空方法

   

猜你喜欢

转载自www.cnblogs.com/zhengleilei/p/9420602.html