[英]Datetime error occur in soap php
我現在使用php中的soap方法創建redbus api。
現在我的編碼有一些日期時間問題。 這些是代碼
$c = new soapclient('...wsdl....',
array('Authentication' => array('LoginID' =>'x','Password'=>'x')));
$timezone = new DateTimeZone('UTC');
$time='2012-04-17T16:50:45';
$date = new DateTime($time,$timezone);
$sourceid=array('SourceID'=>'244','DestinationID'=>'477','DateOfJourney' =>$date);
它顯示錯誤為致命錯誤:未捕獲的SoapFault異常:[soap:Client]服務器無法讀取請求。 ---> XML文檔(2,252)中有錯誤。 --->字符串''不是有效的AllXsd值
我這應該是日期問題
好的,如果您在PHP中需要它,則為:
更換
$sourceid=array('SourceID'=>'244','DestinationID'=>'477','DateOfJourney' =>$date);
同
$sourceid=array('SourceID'=>'244','DestinationID'=>'477','DateOfJourney' =>str_replace($date->format( 'P' ), '', $date->format( 'c' )));
希望這可以幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.