Php $请求[';操作';]!=';foo';don';在if语句中不起作用
我有以下功能:Php $请求[';操作';]!=';foo';don';在if语句中不起作用,php,if-statement,httprequest,Php,If Statement,Httprequest,我有以下功能: public function output_berater(){ if($_REQUEST["action"] != "berater_formular_suche" || $_REQUEST["action"] != "thema_formular_suche"){ print_r($_REQUEST["action"]); } return $output; } 如果我发送了一个带有隐藏字段berater\u
public function output_berater(){
if($_REQUEST["action"] != "berater_formular_suche" || $_REQUEST["action"] != "thema_formular_suche"){
print_r($_REQUEST["action"]);
}
return $output;
}
如果我发送了一个带有隐藏字段berater\u formular\u suche
或thema\u formular\u suche
的表单,则打印
不应显示在屏幕上
我想=代码>如果不是,请说“”
可能有一些带有$\u REQUEST
和if语句的特价商品
有人能解释一下为什么我的打印机会显示出来吗
编辑:
如果我提交表格:
输出$\u请求
Array
(
[action] => berater_formular_suche
[berater] => klaus-testname
)
如果我没有提交我的表格:
输出$\u请求
Array
(
[action] => berater_formular_suche
[berater] => klaus-testname
)
空数组。您必须使用&
而不是|
if($_REQUEST["action"] != "berater_formular_suche" && $_REQUEST["action"] != "thema_formular_suche"){
或者,您可以加载到阵列中,然后轻松检查:
$possible_values = ["berater_formular_suche","thema_formular_suche"];
if(!in_array($_REQUEST['action'],$possible_values)) { // Check if your posted values is not in array
print_r($_REQUEST["action"]);
}
您必须使用&&
而不是|
if($_REQUEST["action"] != "berater_formular_suche" && $_REQUEST["action"] != "thema_formular_suche"){
或者,您可以加载到阵列中,然后轻松检查:
$possible_values = ["berater_formular_suche","thema_formular_suche"];
if(!in_array($_REQUEST['action'],$possible_values)) { // Check if your posted values is not in array
print_r($_REQUEST["action"]);
}
我想你可以像这样使用它
e、 g
我想你可以像这样使用它
e、 g
打印($\u请求)
并发布其value@Saty我编辑我的问题。打印($\u请求)
并发布其value@Saty我编辑我的问题,我想就是这样。你能告诉我在哪里可以在wordpress的add\u快捷码中传递$\u请求吗?添加_短码('berater_ausgabe',数组($this,'output_berater');我想就是这样。你能告诉我在哪里可以在wordpress的add\u快捷码中传递$\u请求吗?添加_短码('berater_ausgabe',数组($this,'output_berater');打印仍显示为H正常。我会测试一下。谢谢。是的,它很有效。对不起,我不知道我的错误在哪里。打印仍在显示。好的。我会测试一下。谢谢。是的,它很有效。对不起,我不知道我的错在哪里。