当前位置:网站首页>[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
边栏推荐
- idea開發工具常用的插件合集匯總
- LCD之MIPI协议的一些说明
- Fabric. JS iText sets the color and background color of the specified text
- MySQL foundation --- query (learn MySQL foundation in 1 day)
- Zzuli:1064 encrypted characters
- Conglin environmental protection rushes to the scientific and Technological Innovation Board: it plans to raise 2billion yuan, with an annual profit of more than 200million yuan
- Zzuli:1066 character classification statistics
- 2022-2-14 learning xiangniuke project - Section 7 account setting
- Yyds dry inventory what is test driven development
- 数理统计与机器学习
猜你喜欢
Cube magique infini "simple"
centos8安裝mysql8.0.22教程
[technical notes-08]
软件测试基础篇
Installation du tutoriel MySQL 8.0.22 par centos8
Opencv LBP features
Straighten elements (with transition animation)
青训营--数据库实操项目
Fabric. JS iText sets the color and background color of the specified text
2022-2-14 learning xiangniuke project - Section 6 displays login information
随机推荐
Pytorch Basics
《CGNF: CONDITIONAL GRAPH NEURAL FIELDS》阅读笔记
Here comes a new chapter in the series of data conversion when exporting with easyexcel!
Fabric. JS gradient
"Simple" infinite magic cube
h5跳小程序
How to write good code - Defensive Programming Guide
Thunder on the ground! Another domestic 5g chip comes out: surpass Huawei and lead the world in performance?
Pytorch Chinese document
2022-2-14 learning xiangniuke project - Section 7 account setting
线程池概述
【技术随记-08】
Yyds dry inventory what is test driven development
记录sentry的踩坑之路
小程序跳装到公众号
Zzuli:1064 encrypted characters
5g market trend in 2020
Software testing learning - day 4
Résumé de la collection de plug - ins couramment utilisée dans les outils de développement idea
Basic use of form