Home >Backend Development >PHP Tutorial >Detailed introduction to php hessian_PHP tutorial

Detailed introduction to php hessian_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:08:17828browse

What is hessian?
When I saw this word, I didn’t know how to pronounce it. The phonetic symbol is [hes] pronounced Heisen.
Hessian is a lightweight remote data exchange tool that provides the function of RMI (remote method invocation) using a simple method. Compared with webservice, hessian is simpler and faster. The binary rpc protocol is used. Because it is a binary protocol, it is very suitable for sending binary data
hessian is language independent.
2. How to use it in the php tutorial?
Do you think this can be used just like soap by opening one in php.ini? I think so too. Yes
What I'm here to tell you is that it's wrong to think so.
You need to download a hessianphp library to use.
Download address http://hessianphp.sourceforge.net/
3. See how to use it.
1. Server side.
Copy the code. The code is as follows:
include_once('hessianphp/dist/hessianservice.php');
class helloworldservice
{
public function __construct()
{
}
public function add($a, $b)
{
return $a+$b;
}
}
$wrapper = new hessianservice();
$wrapper->registerobject(new helloworldservice);
$wrapper->displayinfo = true;
$wrapper->service();
?>

Server side results

2. Client
Copy the code. The code is as follows:
require_once 'hessianphp/dist/hessianclient.php';
hessian::errorreporting(hessian_silent);
$url = 'http://localhost/info.php';
$proxy = & new hessianclient($url);
$sum = $proxy->add(3, 5);
echo $sum;
if(hessian::error()) {
$errors = hessian::error();
print_r($erros->message);
//var_dump($errors);
}
?>

client results

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/629851.htmlTechArticleWhat is hessian? When I saw this word, I didn’t know how to pronounce it. The phonetic symbol is [hes] pronounced Heisen. hessian is a lightweight remote data exchange tool that provides...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn