thinkphp webservice简单实现
class Api {
private $key=null;
public function __construct() {
}
//设置key
public function setkey($key){
$this->key = $key;
return "";
}
//验证key
private function check_key(){
if($this->key=='xxx'){
return true;
}
return false;
}
public function getInfo($lastupdt){
return "1231";
}
}
class WbsAction extends Action {
protected function _initialize(){
$this->url = "http://localhost/xx/";
import("SoapDiscovery");
}
public function index() {
if (IS_POST) {
$servidorSoap = new SoapServer($this->url."?wsdl");
$servidorSoap->setClass('Api');
$servidorSoap->handle();
}else{
$disco = new SoapDiscovery('Api','MyApi');
header("Content-type: text/xml");
if (isset($_SERVER['QUERY_STRING']) && strcasecmp($_SERVER['QUERY_STRING'],'wsdl')==0) {
echo $disco->getWSDL();
}
else {
echo $disco->getDiscovery();
}
}
}
public function test(){
$time = I("t");
ini_set('soap.wsdl_cache_enabled', "0");//注意该选项 soap有缓存
$client = new SoapClient($this->url."?wsdl");
$client->setkey('xxxx');
//$client = new Api();
try {
//$result = $client->select('ieliwb');
$result = $client->getInfo("$time");
var_dump($result);
}
catch (SoapFault $f){
echo "Error Message: {$f->getMessage()}";
}
}
}
SoapDiscovery.class.zip
( 2.19 KB 下载:423 次 )
AD:真正免费,域名+虚机+企业邮箱=0元

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

ZendStudio 13.5.1 Mac
強大的PHP整合開發環境

Atom編輯器mac版下載
最受歡迎的的開源編輯器

Safe Exam Browser
Safe Exam Browser是一個安全的瀏覽器環境,安全地進行線上考試。該軟體將任何電腦變成一個安全的工作站。它控制對任何實用工具的訪問,並防止學生使用未經授權的資源。

SublimeText3 Linux新版
SublimeText3 Linux最新版

SublimeText3漢化版
中文版,非常好用