php 找不到“SoapClient”类
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16720799/
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
Class 'SoapClient' not found
提问by mayank
I am integrating a payment gateway using SOAP. When i am calling service function using Wamp its working well. But on my live server it is giving folloing error- Class 'SoapClient' not found
我正在使用 SOAP 集成支付网关。当我使用 Wamp 调用服务功能时,它运行良好。但是在我的实时服务器上,它给出了以下错误-找不到“SoapClient”类
the code i am using is
我使用的代码是
<?php
try
{
$soap_client=new SoapClient("WebServiceLink/service.asmx?WSDL");
$quote=$soap_client->PGI_TRANS("PassedParameter");
echo $quote->PGI_TRANSResult;
}
catch(SoapFault $exception)
{
echo $exception->getmessage();
}
?>
回答by Harrison Wang
enable your soap extension in php. open php.ini find the line have "php_soap" and uncomment this line, restart web server, problem solved.
在php中启用你的soap扩展。打开php.ini,找到“php_soap”行,取消注释,重启web服务器,问题解决。
回答by Nick
You shouldn't have to modify php.ini to enable soap on modern distributions. If it's not enabled, the package probably isn't installed. Once you install the correct package, your distro should enable the correct php.ini settings for you.
您不必修改 php.ini 即可在现代发行版上启用soap。如果未启用,则可能未安装该软件包。一旦你安装了正确的包,你的发行版应该为你启用正确的 php.ini 设置。
On Ubuntu:
在 Ubuntu 上:
sudo apt-get install php-soap
will install and enable the soap extensions for you.
将为您安装并启用soap扩展。
回答by shukshin.ivan
For Ubuntu17.10 ArtfulI've used the following command to view exact package name (it can be different).
对于Ubuntu17.10 Artful,我使用以下命令查看确切的包名称(可以不同)。
>> apt-cache search php | grep -i soap
libnusoap-php - SOAP toolkit for PHP
php7.1-soap - SOAP module for PHP
python-pysimplesoap - simple and lightweight SOAP Library (Python 2)
python3-pysimplesoap - simple and lightweight SOAP Library (Python 3)
php-soap - SOAP module for PHP [default]
php5.6-soap - SOAP module for PHP
php7.0-soap - SOAP module for PHP
php7.2-soap - SOAP module for PHP
That's how I get the name. Then just install it.
这就是我得到这个名字的方式。然后只需安装它。
sudo apt-get install php5.6-soap
P.S. Don't forget to update repository sudo apt-get install php-soap
PS不要忘记更新存储库 sudo apt-get install php-soap
回答by Hymanie Lee
For Ubuntu, running the following commands fixed my issue,
对于 Ubuntu,运行以下命令解决了我的问题,
sudo apt-get install php-soap
then run
然后运行
sudo service apache2 restart
回答by Mayur
You have to inherit nusoap.php class and put it in your project directory, you can download it from the Internet.
您必须继承nusoap.php 类并将其放在您的项目目录中,您可以从网上下载它。
Download Link: http://sourceforge.net/projects/nusoap/
下载链接:http: //sourceforge.net/projects/nusoap/
Use this code:
使用此代码:
require_once('nusoap.php');
require_once('nusoap.php');