警告:字符串偏移量'处理程序'在第57行的C:\ wamp \ www \ whois \ whois \ whois.gtld.php中 [英] Warning: Illegal string offset 'handler' in C:\wamp\www\whois\whois\whois.gtld.php on line 57

查看:68
本文介绍了警告:字符串偏移量'处理程序'在第57行的C:\ wamp \ www \ whois \ whois \ whois.gtld.php中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用phpwhois php类查找网络域的whois详细信息( http://sourceforge.net/projects/phpwhois/),而我正在本地主机上使用此脚本.当我使用以下代码运行此脚本时,它显示错误.请告诉我我要去哪里了

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

代码

<?php
include('whois/whois.main.php');

$whois = new Whois();
$query = 'google.com';
$result = $whois->Lookup($query,false);
echo "<pre>";
var_dump($result);
echo "</pre>";
?>

  • 错误是
  • :警告:第57行的C:\ wamp \ www \ whois \ whois \ whois.gtld.php中的字符串偏移量'handler'非法

    推荐答案

    第57行的代码期望$ query是具有元素'handler'=>的数组?
    但是原始查询 string 传递给该方法,因此出现了非法的偏移量警告.
    http://的错误跟踪器中sourceforge.net/tracker/index.php?func=detail&aid=3605711&group_id=31207&atid=401654 修正此问题的建议是更改

    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);
    

    if (isset($query['handler'])) {
      $handler = $query['handler'];
    } else {
      $handler = $query;
    }
    $this->SUBVERSION = sprintf('%s-%s', $handler, $this->HANDLER_VERSION);
    

    但是我在项目中没有发现字符串 SUBVERSION 的其他任何出现,所以我现在只将该行作为注释....

    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....

    这篇关于警告:字符串偏移量&amp;#39;处理程序&amp;#39;在第57行的C:\ wamp \ www \ whois \ whois \ whois.gtld.php中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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