我正在尝试使用 SoapClient 向 WSDL 文件发送请求,但收到此错误
找不到类"App\Http\Controllers\SoapClient">
我尝试添加SoapClient->callSoap()
use SoapClient;
仍然收到错误,并且我的 soap 扩展已启用。
这是我在控制器中的代码:
$client = new SoapClient('https://adm.com/api/service.php?wsdl');
$headerbody = array('OrgId'=>'4AWisEr','OrgKey'=>'ikaroXajiD');
$header = new SoapHeader('https://adm.com/api/service.php?wsdl','credentials',$headerbody);
$client->__setSoapHeaders($header);
$result = $client->emailExists($email);
return $result;
刚刚尝试了这个,我没有收到命名空间错误:
<?php
namespace AppHttpControllers;
use SoapClient;
class TestController extends Controller
{
public function index()
{
$client = new SoapClient('https://adm.com/api/service.php?wsdl');
}
}