2016-08-10 100 views
0

我用這個PHP代碼:如何添加額外的信息到PHP數組

public function checkout(&$order, &$response) 
    { 
     $settings = Settings::get($order->seller_id); 
     $readon= 'maksājums'; 
     $readon= $order->id; 
     $order->custom([ 
      'payment_details' => [ 
       'bank_name' => [ 'label' => $this->_->_('Bank Name'), 'value' => $settings->bank_name ], 
       'account_owner' => [ 'label' => $this->_->_('Account Owner'), 'value' => $settings->account_owner ], 
       //'bic' => [ 'label' => $this->_->_('BIC/SWIFT'), 'value' => $settings->bic ], 
       'iban' => ['label' => $this->_->_('IBAN'), 'value' => $settings->iban ], 
       'reason' => [ 'label' => $this->_->_('Reason for Payment'), 'value' => $readon], 
      ], 
     ]); 

     $response = []; 
     $response['redirect'] = $this->meta('manual_url'); 

     return Payment::STATUS_OK; 
    } 

問題是,我要上的readOn值添加額外的文本。現在$ readon只顯示訂單號,但我希望它顯示「請爲訂單號$ order-> id付款」

+3

Like'$ readon =「請爲訂單號{$ order-> id}」'付款嗎? – Justinas

回答

0

只需將字符串與您需要的連接在一起。像這樣,

$readon= "Please make payment for Order No. ".$order->id; 
+0

謝謝。它的工作原理:) – user2482734

+0

太好了,如果它對你有幫助,請接受答案。 –