当前位置:网站首页>[PHP是否安装了 SOAP 扩]对于php实现soap代理的一个常见问题:Class ‘SoapClient‘ not found in PHP的处理方法
[PHP是否安装了 SOAP 扩]对于php实现soap代理的一个常见问题:Class ‘SoapClient‘ not found in PHP的处理方法
2022-07-02 05:47:00 【杰儿__er】
浏览器查看php的版本
phpstudy-网站-管理-打开根目录
开启soap扩展
- 查看php配置信息
- 在根目录下编写test.php文件,内容如下:

- 打开浏览器查看配置文件信息:地址栏输入http://localhost/test.php,并查找soap信息:

- 开启soap扩展

- 再次查看php配置信息,查找soap是否开启成功
- 打开浏览器查看配置文件信息:地址栏输入http://localhost/test.php,并查找soap信息:

重启apache

Web Service 实例
在根目录下创建soap文件夹,文件结构如下:
Client.php
<?php
try{
// non-wsdl方式调用web service
// 创建 SoapClient 对象
$soap = new SoapClient(null,array('location'=>"http://localhost/soap/Server.php",'uri'=>'Server.php'));
// 调用函数
$result1 = $soap->getName();
$result2 = $soap->__soapCall("getUrl",array());
echo $result1."<br/>";
echo $result2;
} catch(SoapFault $e){
echo $e->getMessage();
}catch(Exception $e){
echo $e->getMessage();
}
Server.php
<?php
// SiteInfo 类用于处理请求
Class SiteInfo
{
/**
* 返回网站名称
* @return string
*
*/
public function getName(){
return "菜鸟教程-test";
}
public function getUrl(){
return "www.runoob.com";
}
}
// 创建 SoapServer 对象
$s = new SoapServer(null,array("location"=>"http://localhost/soap/Server.php","uri"=>"Server.php"));
// 导出 SiteInfo 类中的全部函数
$s->setClass("SiteInfo");
// 处理一个SOAP请求,调用必要的功能,并发送回一个响应。
$s->handle();
?>
测试webservice实例
打开浏览器输入:http://localhost/soap/Client.php
参考链接:https://blog.csdn.net/gayayang/article/details/6953367
边栏推荐
- Zzuli:1069 learn from classmate Z
- all3dp. All Arduino projects in com website (2022.7.1)
- Technologists talk about open source: This is not just using love to generate electricity
- Generate QR code
- Thread pool overview
- 文件包含漏洞(二)
- RGB infinite cube (advanced version)
- 2022-2-14 learning xiangniuke project - section 23, section 5, development login and exit functions
- RNN recurrent neural network
- Operator details
猜你喜欢

Straighten elements (with transition animation)

“简单”的无限魔方

centos8安裝mysql8.0.22教程

Lingyunguang rushes to the scientific innovation board: the annual accounts receivable reaches 800million. Dachen and Xiaomi are shareholders

kmp思想及模板代码

Practice C language advanced address book design
![Gee series: unit 8 time series analysis in Google Earth engine [time series]](/img/a6/648ff959af93c22dc8605215a90535.jpg)
Gee series: unit 8 time series analysis in Google Earth engine [time series]

RGB 无限立方体(高级版)

Balsamiq wireframes free installation

File contains vulnerabilities (II)
随机推荐
1037 Magic Coupon
Zzuli:1060 numbers in reverse order
I want to understand the swift code before I learn it. I understand it
Here comes a new chapter in the series of data conversion when exporting with easyexcel!
Online English teaching app open source platform (customized)
Win10 copy files, save files... All need administrator permission, solution
Zzuli:1064 encrypted characters
Yyds dry inventory what is test driven development
File contains vulnerabilities (II)
数理统计与机器学习
死磕大屏UI,FineReport开发日记
OLED12864 液晶屏
File contains vulnerability (I)
Fabric. JS background is not affected by viewport transformation
MySQL foundation --- query (learn MySQL foundation in 1 day)
Vite打包后的dist不能直接在浏览器打开吗
Foreign trade marketing website system development function case making
2022-2-14 learning xiangniuke project - Section 7 account setting
Alibaba: open source and self-developed liquid cooling data center technology
Fabric. JS three methods of changing pictures (including changing pictures in the group and caching)