magento 2

时间:2017-04-18 08:25:13

标签: php zend-framework magento2

我正在使用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 \框架\ APP \响应\ HTTP \ Interceptor-> ___ callPlugins(' sendResponse&#39 ;,   数组,数组)#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 \框架\ APP \ HTTP-> handleDeveloperMode(对象(Magento的\框架\ APP \自举),   对象(Zend \ Uri \ Exception \ InvalidUriException))#11
  /var/www/html/voylite/vendor/magento/framework/App/Bootstrap.php(263):   的Magento \框架\ APP \ HTTP-> catchException(对象(Magento的\框架\ APP \自举),   对象(Zend \ Uri \ Exception \ InvalidUriException))#12
  /var/www/html/voylite/index.php(38):   的Magento \框架\ APP \ Bootstrap->运行(对象(Magento的\框架\ APP \ HTTP))   #13 {main}

2 个答案:

答案 0 :(得分:1)

为了获得更多帮助,在开发Ajax Controller / Action时遇到了完全相同的错误。

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

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

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

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

但是在一个特定的情况下,我忘记设置URL并导致了上一个错误。在发现问题出自这个小错误之前,我经过了一些努力。

我希望这可以帮助其他人。

答案 1 :(得分:0)

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