【问题标题】:Zend framework error in magento 2Magento 2中的Zend框架错误
【发布时间】:2017-09-13 23:59:18
【问题描述】:

我正在使用 magento 2 开发电子商务网站。从主页添加产品时出现错误:

Zend\Uri\Exception\InvalidUriException: URI 无效,不能 转换成字符串在 /var/www/html/voylite/vendor/zendframework/zend-uri/src/Uri.php:359 堆栈跟踪:#0
/var/www/html/voylite/vendor/zendframework/zend-http/src/Header/AbstractLocation.php(98): Zend\Uri\Uri->toString() #1
/var/www/html/voylite/vendor/zendframework/zend-http/src/Header/AbstractLocation.php(133): Zend\Http\Header\AbstractLocation->getUri() #2
/var/www/html/voylite/vendor/zendframework/zend-http/src/PhpEnvironment/Response.php(98): Zend\Http\Header\AbstractLocation->toString() #3
/var/www/html/voylite/var/generation/Magento/Framework/App/Response/Http/Interceptor.php(310): Zend\Http\PhpEnvironment\Response->sendHeaders() #4
/var/www/html/voylite/vendor/zendframework/zend-http/src/PhpEnvironment/Response.php(128): Magento\Framework\App\Response\Http\Interceptor->sendHeaders() #5
/var/www/html/voylite/var/generation/Magento/Framework/App/Response/Http/Interceptor.php(336): Zend\Http\PhpEnvironment\Response->send() #6
/var/www/html/voylite/vendor/magento/framework/HTTP/PhpEnvironment/Response.php(44): Magento\Framework\App\Response\Http\Interceptor->send() #7
/var/www/html/voylite/vendor/magento/framework/Interception/Interceptor.php(146): Magento\Framework\HTTP\PhpEnvironment\Response->sendResponse() #8
/var/www/html/voylite/var/generation/Magento/Framework/App/Response/Http/Interceptor.php(117): Magento\Framework\App\Response\Http\Interceptor->___callPlugins('sendResponse', 数组,数组)#9
/var/www/html/voylite/vendor/magento/framework/App/Http.php(185): Magento\Framework\App\Response\Http\Interceptor->sendResponse() #10
/var/www/html/voylite/vendor/magento/framework/App/Http.php(156): Magento\Framework\App\Http->handleDeveloperMode(Object(Magento\Framework\App\Bootstrap), 对象(Zend\Uri\Exception\InvalidUriException)) #11
/var/www/html/voylite/vendor/magento/framework/App/Bootstrap.php(263): Magento\Framework\App\Http->catchException(对象(Magento\Framework\App\Bootstrap), 对象(Zend\Uri\Exception\InvalidUriException)) #12
/var/www/html/voylite/index.php(38): Magento\Framework\App\Bootstrap->运行(对象(Magento\Framework\App\Http)) #13 {主}

【问题讨论】:

    标签: php zend-framework magento2


    【解决方案1】:

    为了进一步的帮助,我在开发 Ajax 控制器/动作时遇到了完全相同的错误。

    我正在准备 $result 对象来发送响应:

    $result = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
    

    在某些情况下,根据处理结果设置重定向 URL:

    $result->setUrl($this->_url->getUrl('checkout/onepage/success'));
    

    但在一个特定的情况下,我忘记设置 URL 并导致上一个错误。在发现问题出在这个小错误之前,我有点挣扎。

    我希望这对其他人有帮助。

    【讨论】:

      【解决方案2】:

      您设置的 URI 无效,修复它。如果没有真正了解您的意见,很难提供更多帮助。

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多