$ request问题 [英] $request problem

查看:47
本文介绍了$ request问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以看到这个问题吗?我是傻瓜吗?


if(!isset($ _ REQUEST [" input"])||"" == $ _REQUEST [" input"])

{

抛出新的异常(需要查询);

}

其他

{

echo"< p>搜索字词:$ _REQUEST [输入]" ;;

}

/ *

*将输入拆分为查询字数组

* /

$ queries = array_map(mysql_real_escape_string,explode("",

$ _REQUEST [" input"]));

这适用于运行PHP5的一台服务器,但不适用于另一台服务器。两个apache。

我已经检查了php.ini但是看不出为什么这个看似简单的

代码应该在一个实例中失败。

在无法工作的情况下,$ query设置为"在哪里我会

期望它被设置为$ _REQUEST [" input"]值的数组,

在每个空格分开。


即使使用error_reporting(E_ALL)也没有报告错误;


$ _REQUEST肯定是设置为echo线打印输出为

预期。

Can anybody see a problem with this? Am I being stupid?

if (!isset($_REQUEST["input"]) || "" == $_REQUEST["input"])
{
throw new Exception("need query");
}
else
{
echo "<p>Search words: $_REQUEST[input]";
}
/*
* split input into array of query words
*/
$queries = array_map(mysql_real_escape_string, explode(" ",
$_REQUEST["input"]));
This works on one server, running PHP5, but not another. Both apache.
I''ve checked php.ini but cannot see why this seemingly simple bit of
code should fail in one instance.

In the one where it fails to work $queries is set to "" where I would
expect it to be set to an array of the values of $_REQUEST["input"],
split at each space.

No errors are reported even with error_reporting(E_ALL);

$_REQUEST is definitely set as the echo line prints out the input as
expected.

推荐答案

_REQUEST [" input"])|| "" ==
_REQUEST["input"]) || "" ==


_REQUEST [" input"])

{

抛出新的异常(需要查询); < br $>
}

其他

{

echo"< p>搜索词:
_REQUEST["input"])
{
throw new Exception("need query");
}
else
{
echo "<p>Search words:


_REQUEST [input]" ;;

}

/ *

*将输入拆分为查询字数组
* /
_REQUEST[input]";
}
/*
* split input into array of query words
*/


这篇关于$ request问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆