本文实例讲述了thinkphp中自定义错误页面和提示页面的方法。分享给大家供大家参考。具体实现方法如下:
在ThinkPHP中有两个方法时提示错误页面 _404('错误信息','跳转的地址');halt('提示信息');
这两个函数都可以自定义错误页面在配置文件中加
下面是我定制的错误页面
$this->success('错误信息','跳转的地址(最好用U())',时间);
$this->error();
下面是我改变ThinkPHP中的提示页面
<br><p style="font: italic bold 2cm cursive,serif; color:green"> <br> ok <br></p> <br><div class="success" style="width:100%;text-align:left;padding-left:10px;padding-right:10px"> <br> <br> </div> <br><else></else> <br><p style="font: italic bold 2cm cursive,serif; color:red"> <br> × <br></p> <br><div class="error" style="width:100%;text-align:left;padding-left:10px;padding-right:10px"> <br> </div> <br><br><p> <br> 在( <span id="sec" style="color:blue;font-weight:bold"></span> )秒后自动跳转,或直接点击 <a href="javascript%EF%BC%9Awindow.location='<?php%20echo(%24jumpUrl);%20?>'">这里</a> 跳转<br> <br><span style="display:block;text-decoration:underline;cursor:pointer;line-height:25px" onclick="stop(this)">停止</span> <br></p> <br>
希望本文所述对大家的ThinkPHP框架程序设计有所帮助。
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号