我用的是php5.4.刚安装了scws分词模块,但是运行时出现如下情况:
Strict Standards: Redefining already defined constructor for class PSCWS3 in D:\php\wamp\www\scws\pscws3.class.php on line 145Strict Standards: Redefining already defined constructor for class PSCWS23_Dict in D:\php\wamp\www\scws\dict.class.php on line 48Strict Standards: Redefining already defined constructor for class xdb_Dictionary in D:\php\wamp\www\scws\dict.class.php on line 148Strict Standards: Redefining already defined constructor for class dba_Dictionary in D:\php\wamp\www\scws\dict.class.php on line 201Strict Standards: Redefining already defined constructor for class sql_Dictionary in D:\php\wamp\www\scws\dict.class.php on line 257Strict Standards: Redefining already defined constructor for class txt_Dictionary in D:\php\wamp\www\scws\dict.class.php on line 315Strict Standards: Redefining already defined constructor for class XDB_R in D:\php\wamp\www\scws\xdb_r.class.php on line 34
php.ini中的错误报告error_reporting我也改了,我将error_reporting = E_ALL & ~E_NOTICE直接去掉了,还是没用,请问这该怎么解决。分词功能都能实现,就是出现上面的错误报告。

解决方案 »

  1.   

    只能说你的设置并没有生效,你是否重启过apahce, php-fpm呢? 或者你修改的php.ini并非当前解释器所使用的那个(具体可看phpinfo()中的"configure file"项指定的配置文件位置)
      

  2.   

    你也可以安装SCWS 1.2.0版来解决这些问题 
    2012-3-29: SCWS-1.2.0 Released.
    1) 修改 php 扩展代码以兼容支持 php 5.4.x
    2) 修正 php 扩展中 scws_get_tops 的 limit 参数不允许少于 10 的问题
    3) libscws 增加 scws_fork() 从既有的 scws 实例产生分支并共享词典/规则集,主要用于多线程开发。
    4) 新增部分版本的 win32 的 dll 扩展,详见下载页面
      

  3.   

    回一楼:  我用的是wampserver软件,我就在安装目录中改的,改了之后重启了下,没用,
      

  4.   

    是不是有同名的函数 什么的 自己检查一下看看。
    另外有没安装那个zend guard 是的话卸载了看看
      

  5.   

    我将error_reporting = E_ALL & ~E_NOTICE直接去掉了,还是没用
    你这是什么意思?
    注释掉 error_reporting,即不设置 error_reporting 时,php 将按默认的最严格的方式检查错误对于 Strict Standards 类型错误,php5.3 默认不检查,而php5.4默认检查
    开发环境中一般应有
    error_reporting = E_ALL | E_STRICT
    这样可以发现你的程序隐患关于出错的原因:
    在 pscws3.class.php 中
    82行 class PSCWS3
    103行 function PSCWS3($dictfile = '')
    145行 function __construct($dictfile = '') { $this->PSCWS3($dictfile); }
    其中103行的方法名 PSCWS3 与类名相同,被视为构造函数(兼容php4)
    145行又声明了构造函数(php5)
    所以出错在不改动代码的情况下,可令
    error_reporting = E_ALL & ~E_STRICT
    来回避此错误实际应用时应在公共代码中加入 
    error_reporting( E_ALL & ~E_STRICT );
    而不是修改 php.ini
    因为你可能没有修改 php.ini 的权限;其他应用可能需要另外的配置
      

  6.   

    谢谢各位的帮助,我已经按照你们的方法试了,没有用。我吧我php.ini中的相关代码给你们看下:
    ; error_reporting
    ;   Default Value: E_ALL & ~E_NOTICE
    ;   Development Value: E_ALL | E_STRICT
    ;   Production Value: E_ALL & ~E_DEPRECATED希望能帮我在想个法子
      

  7.   

    不是已经跟你说了吗?
    在 php.ini 中令
    error_reporting = E_ALL & ~E_STRICT或在程序中执行
    error_reporting( E_ALL & ~E_STRICT );
      

  8.   

    你的方法我试过了,我把改后的给你看下:;error_reporting = E_ALL & ~E_STRICT
    ;   Default Value: E_ALL & ~E_NOTICE
    ;   Development Value: E_ALL | E_STRICT
    ;   Production Value: E_ALL & ~E_DEPRECATED然后我写了如下测试代码:
    <?php
    error_reporting(E_ALL ^ E_NOTICE);
    $string="调用 segment 方法执行词汇切割";
    require 'pscws3.class.php';$pscws = new PSCWS3('dict\dict.xdb');
    $res = $pscws->segment($string);
    print_r($res);?>
    。测试效果还是老样子
      

  9.   

    error_reporting 函数的设置优先于 php.ini 中的 error_reporting 设置虽然你在 php.ini 中用 error_reporting = E_ALL & ~E_STRICT 屏蔽了 E_STRICT 级别错误
    但你在程序中的 error_reporting(E_ALL ^ E_NOTICE); 又将其打开了error_reporting( E_ALL & ~E_STRICT & ~E_NOTICE );
      

  10.   

    我也是有这个问题Strict Standards: Redefining already defined constructor for class PSCWS4 in C:\xampp\htdocs\pscws4\pscws4.class.php on line 120Strict Standards: Redefining already defined constructor for class XDB_R in C:\xampp\htdocs\pscws4\xdb_r.class.php on line 34你是按那个办法解决的?
      

  11.   


    我也遇到这个问题,然后在php.ini中改错误报告级别也没用,是因为文件中的error_reporting()设置级别高于php.ini中,所以需要直接更改文件中的error_reporting级别来屏蔽strict standards提示