当前位置:网站首页>[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
边栏推荐
- Taskbar explicit / implicit toggle function
- Gcnet: non - local Networks meet Squeeze excitation Networks and Beyond
- Online English teaching app open source platform (customized)
- The Hong Kong Stock Exchange learned from US stocks and pushed spac: the follow-up of many PE companies could not hide the embarrassment of the world's worst stock market
- Grbl software: basic knowledge of simple explanation
- Record sentry's path of stepping on the pit
- Fabric. JS gradient
- Online music player app
- 6. Network - Foundation
- Practice C language advanced address book design
猜你喜欢
3D 打印机 G 代码命令:完整列表和教程
Operator details
[paper translation] gcnet: non local networks meet squeeze exception networks and beyond
mysql的约束总结
数理统计与机器学习
2022-2-15 learning xiangniuke project - Section 8 check login status
Résumé de la collection de plug - ins couramment utilisée dans les outils de développement idea
Fabric. JS gradient
我所理解的DRM显示框架
[technical notes-08]
随机推荐
kmp思想及模板代码
Fabric. JS gradient
记录sentry的踩坑之路
Storage of data
H5 jump applet
Online music player app
Principle and implementation of parallax effect
Record sentry's path of stepping on the pit
来啦~ 使用 EasyExcel 导出时进行数据转换系列新篇章!
LCD之MIPI协议的一些说明
KMP idea and template code
Thread pool overview
Fabric. JS upload local image to canvas background
VSCode paste image插件保存图片路径设置
Operator details
Thunder on the ground! Another domestic 5g chip comes out: surpass Huawei and lead the world in performance?
ERP management system development and design existing source code
vite如何兼容低版本浏览器
A collection of commonly used plug-ins for idea development tools
Fabric. JS activation input box