PHP 致命错误:在 Laravel 5.4 中找不到“SoapClient”类

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46823623/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 16:49:40  来源:igfitidea点击:

PHP Fatal error: Class 'SoapClient' not found in laravel 5.4

laravel

提问by ayadlin brintha

I am working with laravel 5.4. The controller function that using laravel run in browser is working. Same function I called via scheduler it returns error.

我正在使用 Laravel 5.4。在浏览器中使用 Laravel 运行的控制器功能正在工作。我通过调度程序调用的相同函数返回错误。

Note: Soapclient is enabled in my server. In Controller code:

注意:我的服务器中启用了 Soapclient。在控制器代码中:

use SoapClient;
$client = new SoapClient($wsdl, array(  
                'soap_version' => SOAP_1_1,
                'trace' => true, //to debug 
            ));

and in kernel.php

并在 kernel.php

$schedule->command('eld:fetch')
  ->everyMinute();

采纳答案by Serge Kishiko

PHP Fatal error: Class 'SoapClient' not found in laravel 5.4means that the SoapClientclass does not been enabled in your server. To do so, follow these steps:

PHP Fatal error: Class 'SoapClient' not found in laravel 5.4表示SoapClient该类未在您的服务器中启用。为此,请按照下列步骤操作:

  1. Check first if it's enabled with phpinfo()function and look in the array if SoapClientis mentioned enabled. If it's not enabled, follow the second step.
  2. Uncomment the extension=php_soap.dllline by removing the semicolon at the beginning, in php.inifile.
  3. The next step is to restart your server.
  4. Now return again to the first step to see if SoapClientis now enabled.
  5. At this step, you can now import your class like this:
  1. 首先检查它是否启用了phpinfo()功能,如果SoapClient提到启用,则查看数组。如果未启用,请按照第二步操作。
  2. extension=php_soap.dll通过删除php.ini文件开头的分号来取消注释该行。
  3. 下一步是重新启动服务器。
  4. 现在再次返回第一步,看看SoapClient现在是否已启用。
  5. 在这一步,您现在可以像这样导入您的类:

use SoapClient; $client = new SoapClient($wsdl, array('soap_version' => SOAP_1_1, 'trace' => true));

use SoapClient; $client = new SoapClient($wsdl, array('soap_version' => SOAP_1_1, 'trace' => true));