[英]Multiple Strpos checks
Would there be anyway to merge the below queries into a single function? 无论如何,将以下查询合并到一个函数中吗? As it stands only the second Strpos function works.
就目前而言,仅第二个Strpos函数起作用。 If i remove the second one then the first one will work.
如果我删除第二个,那么第一个将工作。 I need to run both as I have to check for 2 separate strings.
我需要同时运行两个,因为我必须检查2个单独的字符串。
$check1 = QueryWhoisServer($whoisserver, $domain);
if(strpos($check1,"No match for") !== FALSE){
return "Result Example";
}
$check2 = QueryWhoisServer($whoisserver, $domain);
if(strpos($check2,"No Data Found") !== FALSE){
return "Result 2 example";
}
else {
Any help would be much appreciated. 任何帮助将非常感激。
First of all, you should keep the output of your whois query. 首先,您应该保留whois查询的输出。
$response = QueryWhoisServer($whoisserver, $domain);
Then, you can run multiple searches: 然后,您可以运行多个搜索:
if (false !== strpos($response, 'No match for')) {
// ...
} elseif (false !== strpos($response, 'No Data Found')) {
// ...
} else {
// ...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.