【问题标题】:Use zendframework 1 library in zendframework 2在 zendframework 2 中使用 zendframework 1 库
【发布时间】:2014-06-03 14:46:16
【问题描述】:

我是 Zend 和 Piwik. 的新手,我想在我的 ZF2 应用程序中使用 piwik library for zend

但问题是piwik library for zend 是在 ZF1 中构建的,而我的应用程序是在 ZF2 中。

我已经检查了this 在 ZF2 中使用 ZF1 库的解决方案,但它对我不起作用。

我的init_autoloader.phpif($zf2Path){ statement:内略有不同

if ($zf2Path && !class_exists('Zend\Loader\AutoloaderFactory')) {
    if (isset($loader)) {
        $loader->add('Zend', $zf2Path);
        $loader->add('ZendXml', $zf2Path);      
    } else {
        include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
        Zend\Loader\AutoloaderFactory::factory(array(
            'Zend\Loader\StandardAutoloader' => array(
                'autoregister_zf' => true,
            )
        ));
    }
}

我已经像这样更改了 init_autoloader.phpif($zf2Path){ statement: 部分

if ($zf2Path && !class_exists('Zend\Loader\AutoloaderFactory')) {
    if (isset($loader)) {
        $loader->add('Zend', $zf2Path);
        $loader->add('ZendXml', $zf2Path);
    } else {
        include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';

        set_include_path(implode(PATH_SEPARATOR, array($zf1Path, get_include_path())));
        Zend\Loader\AutoloaderFactory::factory(array(
            'Zend\Loader\StandardAutoloader' => array(
                'autoregister_zf' => true,
                'prefixes' => array(
                    'Zend_' => $zf1Path . '/Zend'
                ),
            )
        ));
    }
}

那么有人可以帮我解决这个问题吗?

【问题讨论】:

    标签: php zend-framework zend-framework2 matomo


    【解决方案1】:

    这里有一个 Zend Framework 2 集成:https://github.com/heiglandreas/piwik

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多