简体   繁体   English

在SOAP API PHP中将日期时间作为数组传递

[英]Passing datetime as an array in SOAP API PHP

I have a function like this for a SOAP call for a GetSchedule REQUEST. 对于GetSchedule REQUEST的SOAP调用,我有这样的功能。

public function GetSchedule(array $sessionTypeIDs, array $startDate , array $endDate) 

I usually pass it from my controller like this 我通常是这样从控制器传递过来的

$result1 = $bookservice->GetSchedule(array(114,115,116,127), array(2017-09-25), array(2017-10-15);

When I try to pass dates like this, it gives me a FORBIDDEN error 当我尝试传递这样的日期时,它给了我一个FORBIDDEN错误

SoapFault Forbidden 禁止SoapFault


How can I pass dates properly? 如何正确传递日期? I am using Laravel and I am trying to make a SOAP call. 我正在使用Laravel,并且正在尝试进行SOAP调用。 It's working fine if I don't supply anything for $startDate and $endDate, but if try to filter it by these two variables, I get a Forbidden error. 如果我不为$ startDate和$ endDate提供任何内容,则工作正常,但是如果尝试通过这两个变量对其进行过滤,则会出现禁止错误。

You're passing in a number, since you're not quoting the date it's doing the math (1983). 您传递的是数字,因为您没有引用数字进行数学运算的日期(1983)。 Instead, you need to quote it. 相反,您需要引用它。

$result1 = $bookservice->GetSchedule(array(114,115,116,127), array('2017-09-25'), array('2017-10-15');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM