PHP 5.4中引用的的幾個問題 PHP Notice

問題 I. PHP Notice:  Only variable references should be returned by reference 
在調試函數時 
php

Php代碼  收藏代碼api

  1. function &GetSellerList($request) {  函數

  2.   $request->setVersion(EBAY_WSDL_VERSION);  this

  3.   

  4.   return ($res = & $this->call('GetSellerList', $request););  spa

  5. }  調試


返回錯誤:PHP Notice:  Only variable references should be returned by reference in /projects/ebay_api/tradding_api/EbatNsSamples/EbatNs/EbatNs_ServiceProxy.php on line 979 

修改成: 
rem

Php代碼  收藏代碼io

  1. function &GetSellerList($request) {  function

  2.   $request->setVersion(EBAY_WSDL_VERSION);  List

  3.   $res = & $this->call('GetSellerList', $request);  

  4.   return ($res);  

  5. }  


便可. 

問題 II. PHP Fatal error:  Call-time pass-by-reference has been removed 
運行代碼返回錯誤:[30-Jan-2013 10:51:57 UTC] PHP Fatal error:  Call-time pass-by-reference has been removed in /projects/ebay_api/tradding_api/EbatNsSamples/EbatNs/EbatNs_Client.php on line 245 
由於PHP5.4語法改變,將245行代碼 

Php代碼  收藏代碼

  1. $this->_parser = &new EbatNs_ResponseParser( &$this, $tns, $this->_parserOptions );  


修改成: 

Php代碼  收藏代碼

  1. $this->_parser = &new EbatNs_ResponseParser( $this, $tns, $this->_parserOptions );  


便可. 

相關文章
相關標籤/搜索