找不到Laravel 5.6 SoapClient

时间:2018-07-09 07:41:48

标签: php laravel soap

namespace App\lara;

use SoapClient;
use StdClass;

class abrLookup extends SoapClient {

    private $guid = "xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx"; 

    public function __construct()
    {
        $params = array(
            'soap_version' => SOAP_1_1,
            'exceptions' => true,
            'trace' => 1,
            'cache_wsdl' => WSDL_CACHE_NONE
        ); 

错误

"Class 'SoapClient' not found"

我正在尝试扩展此类,但是这是说找不到肥皂客户端,我正在使用php 7.2。我进入了Apache和php设置,并启用了扩展名,并查看了php设置并启用了它。

soap

Soap Client => enabled
Soap Server => enabled

Directive => Local Value => Master Value
soap.wsdl_cache => 1 => 1
soap.wsdl_cache_dir => /tmp => /tmp
soap.wsdl_cache_enabled => 1 => 1
soap.wsdl_cache_limit => 5 => 5
soap.wsdl_cache_ttl => 86400 => 86400

然后我认为这是一个laravel问题,因此我重新启动了服务器并运行了这些命令

php artisan config:cache

php artisan config:clear

但是我仍然是我的起点,对如何解决此问题一无所知,它在Ubuntu上运行-php V7.2

1 个答案:

答案 0 :(得分:0)

调用SoapClient时,请不要忘记使用全局名称空间:https://www.php.net/manual/en/language.namespaces.global.php

use \SoapClient;