我的PHP SOAP请求变量出现问题。 $ q88Search是变量。它完全像这样
$client = new SoapClient('http://www.q88.com/ws/api.asmx?wsdl');
$q88Search = "Vessel Name";
$params = array("AuthorizationString" => "XXXXXX",
"VesselName" => $q88Search);
$response = $client->__soapCall("GetQ88", array($params));
echo $response->GetQ88Result;
其中变量是字符串 Vessel Name 但如果我从wordpress动态调用变量作为自定义字段,则请求失败。即使自定义字段值相同容器名称或"容器名称" (甚至第二次包含引号。 ) 即
$client = new SoapClient('http://www.q88.com/ws/api.asmx?wsdl');
$q88Search = the_field('q88_search_text');
$params = array("AuthorizationString" => "XXXXX",
"VesselName" => $q88Search);
$response = $client->__soapCall("GetQ88", array($params));
echo $response->GetQ88Result;
如果我回显$ q88Search,它会正确输出为船只名称。所以我相信它的某种变量字符串错误,但我对此非常不满意。 任何帮助将不胜感激。