php5.6版本iconv_set_encoding函数报错Deprecated ,iconv_set_encoding(): Use of iconv.output_encoding is deprecated

在升级到php5.6版本后发现使用iconv_set_encoding函数时报了下面这个错误

PHP Deprecated:  iconv_set_encoding(): Use of iconv.internal_encoding is deprecated in ...  

在php5.6版本之后官方不赞成使用这个函数了,可以使用下面的代码来避免这个问题

if (PHP_VERSION_ID < 50600) {  
    iconv_set_encoding('input_encoding', 'UTF-8');  
    iconv_set_encoding('output_encoding', 'UTF-8');  
    iconv_set_encoding('internal_encoding', 'UTF-8');  
} else {  
    ini_set('default_charset', 'UTF-8');  
}  

亚马逊 MWS接口 调用错误解决办法 Redefinition of parameter $quotaMax

PHP Compile Error – yii\base\ErrorException

Redefinition of parameter $quotaMax

  • 1. in /home/wwwroot/amz.codecenter.cn/frontend/controllers/MarketplaceWebServiceProducts/Model/ResponseHeaderMetadata.phpat line 31
    const REQUEST_ID = 'x-mws-request-id';
      const RESPONSE_CONTEXT = 'x-mws-response-context';
      const TIMESTAMP = 'x-mws-timestamp';
      const QUOTA_MAX = 'x-mws-quota-max';
      const QUOTA_REMAINING = 'x-mws-quota-remaining';
      const QUOTA_RESETS_AT = 'x-mws-quota-resetsOn';
     
      private $metadata = array();
     
      public function __construct($requestId = null, $responseContext = null, $timestamp = null,$quotaMax = null, $quotaMax = null, $quotaResetsAt = null) {
    //    public function __construct($requestId = null, $responseContext = null, $timestamp = null,$quotaMax = null, $quotaRemaining = null, $quotaResetsAt = null) {
        $this->metadata[self::REQUEST_ID] = $requestId;
        $this->metadata[self::RESPONSE_CONTEXT] = $responseContext;
        $this->metadata[self::TIMESTAMP] = $timestamp;
        $this->metadata[self::QUOTA_MAX] = $quotaMax;
        $this->metadata[self::QUOTA_REMAINING] = $quotaMax;
        $this->metadata[self::QUOTA_RESETS_AT] = $quotaResetsAt;
      }
    
    

解决办法

修改一下文件

MarketplaceWebServiceProducts/Model/ResponseHeaderMetadata.php

修改前

public function __construct($requestId = null, $responseContext = null, $timestamp = null,$quotaMax = null, $quotaMax = null, $quotaResetsAt = null) {
    $this->metadata[self::REQUEST_ID] = $requestId;
    $this->metadata[self::RESPONSE_CONTEXT] = $responseContext;
    $this->metadata[self::TIMESTAMP] = $timestamp;
    $this->metadata[self::QUOTA_MAX] = $quotaMax;
    $this->metadata[self::QUOTA_REMAINING] = $quotaMax;
    $this->metadata[self::QUOTA_RESETS_AT] = $quotaResetsAt;
  }

修改后

 
 public function __construct($requestId = null, $responseContext = null, $timestamp = null,$quotaMax = null, $quotaRemaining = null, $quotaResetsAt = null) {
    $this-&gt;metadata[self::REQUEST_ID] = $requestId;
    $this-&gt;metadata[self::RESPONSE_CONTEXT] = $responseContext;
    $this-&gt;metadata[self::TIMESTAMP] = $timestamp;
    $this-&gt;metadata[self::QUOTA_MAX] = $quotaMax;
    $this-&gt;metadata[self::QUOTA_REMAINING] = $quotaRemaining;
    $this-&gt;metadata[self::QUOTA_RESETS_AT] = $quotaResetsAt;
  }