第一步:服务端文件
<?php
$wsdlfile='webservice.wsdl';
ini_set('soap.wsdl_cache_enabled','0'); //关闭WSDL缓存
//001.创建webservice接口类
class UserAction{
//创建用户方法
public function create($username,$password)
{
return 'Create success!';
}
//删除用户方法
public function del($userid)
{
return 'Del success!';
}
}
//002.通过第三方类库创建生成wsdl文件
require_once 'SoapDiscovery.class.php';
$SoapDis=new SoapDiscovery('UserAction','soap'); //soap可以自己定义,无所谓的
$WsdlRev=$SoapDis->getWSDL();
//if(!file_exists($wsdlfile)){
file_put_contents($wsdlfile, $WsdlRev);
//}
//003.通过wsdl创建服务
$webserver = new SoapServer($wsdlfile);
$webserver->setClass('UserAction');
$webserver->handle();第二步:客户端文件
<?php
$ws=new SoapClient('http://learn.cn/webservice.wsdl');
$ret=$ws->create('gao','123456');
var_dump($ret);
?>下载demo:
<?php //高先生简单验证码. //随机数 //为什么循环0-15的数字 //因为要实现最简单的字母和数字混搭 //16进制0-9 a-f //dechex 十进制转换为16进制 //创建一个四位的验证码. //$nmsg.  ...
原理:使用curl_init()创建多个请求实例,再使用curl_multi_init()批量执行创建的多个请求实例。文件1:curl.php<?php $threads=500;//并发请求次数 $url='http://blog.cn/index.php?';...
(1).学习目标: 了解常见信号类型(百度PHP支持的信号类型),(2).相关函数学习: (2.1).pcntl_signal函数用于设置一个信号管理器接收进程信号,参数1:信号类型,参数2:回调函数,用于在接收到参数1类型的信...
最近在公司开发一个新的项目假设项目域名是a.com,需要接入b.com的单点登陆系统。(1).首先我们会在a.com的登陆页面用iframe引入b.com来显示登陆界面,实际上登陆验证操作都是在b.com上面(2).当b.com验证通过,会在前端ajax请求a.com的回调地址,这个回调地址目的就是...
最近在编写windows php多线程的东西,从官网下载了PHP的线程安全版,尝试开启curl扩展extension=php_curl.dllphp -m 却提示 PHP Startup: Unable to load dynamic library 'C:\php\ext\php_curl...
第一次听说端口复用是在mixphp最新版本中发现的,mixphp启动监听9501端口,现在作者说可以多开几个进程来执行mixphp,我心里想了下再启动不是会端口冲突嘛,但是却没有问题,于是下载mixphp的源码解读,原来是启动http服务器使用new Co\Http\Server('0.0....