第一步:服务端文件
<?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:
//参数1 文件名 参数2 缩放比例 function _thumb($_filename,$_percent){ ob_clean();...
<?php $data=array('a'=>1,'b'=>2,'c'=>3,'d'=>4); extract($data); var_dump($a,$b,$c,$d); ?>在人人商城中捡到的...
【一】.介绍session由于HTTP是无状态的请求,创建一个会话需要保持必须需要身份标识。当用户第一次访问,PHP会为用户创建一个唯一的sessionid,并将sessionid通过cookie发送给浏览器,并在服务器的临时文件创建一个以sessionid为名的文件用来保存这个sessionid保...
自己的composer已经发布到packagist,但是无法使用composer require easy-task/easy-task来安装,只能在配置文件使用如下方式安装:"require": { "easy...
当我们使用php爬虫采集网站时经常会遇到内容使用ajax异步加载。一般采取的方案是PHP模拟再请求api接口获取数据,但是有时候前端js加密非常麻烦,我们需要将js的加密方法转换为php方法方便curl请求。当然通过了解我们可以通过3种方案解决。第一种:使用phpv8js扩展执行js代码。(pecl...
【一】.基本用法首先看看官方对send方法的解释:Sets the return value of the yield expression and resumes the generato...