我在尝试从SOAP API服务器获取请求时执行以下php代码
try {
$soap = new SoapClient($wsdl, $options);
$data = $soap->GetXYZ($params);
}
catch(Exception $e) {
$Lastresponse = $soap->__getLastResponse();
}
Run Code Online (Sandbox Code Playgroud)
我得到的只是"看起来我们没有XML文档"的响应代码.
但是当我查看catch块中的$ Lastresponse变量时,我发现它如下:
------=_Part_1134075_393252946.1482317378966 Content-Type: application/xop+xml; charset=utf-8; type="text/xml" <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> ......all valid data ... </SOAP-ENV:Body> </SOAP-ENV:Envelope> ------=_Part_1134075_393252946.1482317378966--
注意:我使用的$ options参数是:
$options = array(
'uri'=>'http://schemas.xmlsoap.org/soap/envelope/',
//'style'=>SOAP_RPC,
//'use'=>SOAP_ENCODED,
'soap_version'=>SOAP_1_1,
'cache_wsdl'=>WSDL_CACHE_NONE,
'connection_timeout'=>15,
'trace'=>true,
'encoding'=>'UTF-8',
'exceptions'=>true
);
Run Code Online (Sandbox Code Playgroud)
虽然我做了一个解析xml的解决方法,但有没有人对这些额外的-----部分位有任何想法?有什么我做错了吗?
我正在尝试上传图像并在同一功能中以不同的尺寸重新调整它们的大小.但是会发生的是,只有一个重新调整大小而其他重组大小不起作用.我的代码是:
function do_upload()
{
$this_user = $this->auth->info;if(!is_dir('./uploads/'.$this_user->username)){
mkdir('./uploads/'.$this_user->username);
mkdir('./uploads/'.$this_user->username.'/photos');
mkdir('./uploads/'.$this_user->username.'/photos/master');
mkdir('./uploads/'.$this_user->username.'/photos/small');
mkdir('./uploads/'.$this_user->username.'/photos/medium');
mkdir('./uploads/'.$this_user->username.'/photos/large');
mkdir('./uploads/'.$this_user->username.'/photos/xlarge');
}
$config['upload_path'] = './uploads/'.$this_user->username.'/photos/master/';
$config['allowed_types'] = 'gif|jpg';
$title = $this->input->post('title');
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
echo '<div id="status">error</div>';
echo '<div id="message">'. $this->upload->display_errors() .'</div>';
}
else
{
$data = array('upload_data' => $this->upload->data());
//resizing begins
$image_width = $data['upload_data']['image_width'];
$image_height = $data['upload_data']['image_height'];
$full_path = $data['upload_data']['full_path'];
//checking for width
if($image_width>5000){
$config['image_library'] = 'gd2';
$config['source_image'] = $full_path;
//$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 5000;
//$config['height'] = 50; …Run Code Online (Sandbox Code Playgroud)