Home > Backend Development > PHP Tutorial > php解决地址栏中参数不正确输入而跳转到的空白页面问题

php解决地址栏中参数不正确输入而跳转到的空白页面问题

WBOY
Release: 2016-06-23 13:41:28
Original
856 people have browsed it

如题。比方说有这样的网址http://localhost:8080/test.php?id=12&tie=23
我在地址栏中把后面两个参数改了,成数值很大的比如说100000,则出现的结果是页面中没有数据输出,或者把参数改成字母或者汉字,则都没有数据输出,,怎么设置可以让这种错误的链接跳转到我指定的错误界面,而不再显示空白的页面!


回复讨论(解决方案)

直接在test.php
页面中加入判断就可以了啊

if($_GET['某一个参数'] == /*不合法*/){    die('<script>localtion.href="指定错误界面的url"</script>');}
Copy after login

if($_GET['某一个参数'] == ‘不合法’){    die('<script>localtion.href="指定错误界面的url"</script>');}
Copy after login


header('Location: http://www.baidu.com/');
exit;

那么如果不能修改php源码的话(被加密),能用Rewrite伪静态的方式解决这个问题吗?

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template