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
PHP Fatal error: Class 'SoapClient' not found in laravel 5.4
提问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 SoapClient
class 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
该类未在您的服务器中启用。为此,请按照下列步骤操作:
- Check first if it's enabled with
phpinfo()
function and look in the array ifSoapClient
is mentioned enabled. If it's not enabled, follow the second step. - Uncomment the
extension=php_soap.dll
line by removing the semicolon at the beginning, inphp.ini
file. - The next step is to restart your server.
- Now return again to the first step to see if
SoapClient
is now enabled. - At this step, you can now import your class like this:
- 首先检查它是否启用了
phpinfo()
功能,如果SoapClient
提到启用,则查看数组。如果未启用,请按照第二步操作。 extension=php_soap.dll
通过删除php.ini
文件开头的分号来取消注释该行。- 下一步是重新启动服务器。
- 现在再次返回第一步,看看
SoapClient
现在是否已启用。 - 在这一步,您现在可以像这样导入您的类:
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));