问题描述
我使用phpwhois php类来查找网域的whois详细信息(),我在我的本地主机上使用这个脚本。当我运行这个脚本使用下面的代码,它显示一个错误。请告诉我出错的地方
代码
?php
include('whois / whois.main.php');
$ whois = new Whois();
$ query ='google.com';
$ result = $ whois-> Lookup($ query,false);
echo< pre>;
var_dump($ result);
echo< / pre>;
?>
- 错误是
:
警告:C:\wamp\www\whois\whois\whois.gtld中的非法字符串偏移处理程序。 php on line 57
57行的代码期望$ query是一个数组, '=>?
但原始查询字符串会传递给该方法,因此会产生非法偏移警告。
在修复此问题的建议是更改
$ this-> SUBVERSION = sprintf('%s-%s',$ query ['handler'],$ this-> HANDLER_VERSION);
到
if(isset($ query ['handler'])){
$ handler = $ query ['handler'];
} else {
$ handler = $ query;
}
$ this-> SUBVERSION = sprintf('%s-%s',$ handler,$ this-> HANDLER_VERSION);
但是我还没有发现字符串 SUBVERSION
在项目中,所以我只是使该行现在的注释....
I'm using phpwhois php class to find whois details of web domains (http://sourceforge.net/projects/phpwhois/) and i'm using this script on my localhost. When i run this script using below code it shows an error. Please tell me where i am going wrong
Code
<?php
include('whois/whois.main.php');
$whois = new Whois();
$query = 'google.com';
$result = $whois->Lookup($query,false);
echo "<pre>";
var_dump($result);
echo "</pre>";
?>
- And the error is
: Warning: Illegal string offset 'handler' in C:\wamp\www\whois\whois\whois.gtld.php on line 57
The code at line 57 expects $query to be an array having an element 'handler'=>?
But the original query string is passed to that method, hence the illegal offset warning.
In the bug tracker at http://sourceforge.net/tracker/index.php?func=detail&aid=3605711&group_id=31207&atid=401654 a suggestion to fix this is to change
$this->SUBVERSION = sprintf('%s-%s', $query['handler'], $this->HANDLER_VERSION);
to
if (isset($query['handler'])) {
$handler = $query['handler'];
} else {
$handler = $query;
}
$this->SUBVERSION = sprintf('%s-%s', $handler, $this->HANDLER_VERSION);
But I haven't found any other occurence of the string SUBVERSION
in the project, so I would just make that line a comment for now....
这篇关于警告:C:\wamp\www\whois\whois\whois.gtld.php在第57行的非法字符串偏移处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!