更新时间:2022-10-18 16:31:14
如果你想分析当前的查询字符串请求:
array_search($ var1,$ _ GET)!== false OR array_search($ var2,$ _ GET)!== false ...
其他:
$ vars = array();
parse_string($ queryString,$ vars);
if(array_search($ var1,$ vars)!== false或array_search($ var2,$ vars)!== false ...
。
I need a bit of simple PHP code that can return a specified variable if any one of three variables is contained within a query string. Probably easier to explain like this:
if {querystring} contains {var1} or {var2} or {var3} return {var1}
This is expands on the following question: Creating a canonical with PHP
I need to add said code to one of the variables specified in function params
, in the linked question.
If you want to analyse the query string of the current request:
array_search($var1,$_GET)!==false OR array_search($var2,$_GET)!==false ....
else:
$vars = array();
parse_string($queryString,$vars);
if(array_search($var1,$vars)!==false OR array_search($var2,$vars)!==false ...
.