PHPRPC is a lightweight, secure, cross-Internet, cross-language, cross-platform, cross-environment, cross-domain, support for transmission of complex objects, support for parameter reference, and support content output redirection, hierarchical error processing, session-based, and service-oriented high-performance remote PHPRPC is different from other ajax frameworks, PHPRPC follows the principle of "only do one thing and do it well. It is only responsible for data transmission, and will be the best transmission! It makes it easy for you to do things that were previously impossible or difficult to do with the traditional ajax method!
I believe that one of the main reasons why many people choose PHPRPC is that it makes it easier for you to develop ajax applications! Although the power of PHPRPC is not limited to this, I have to admit that this is indeed a highlight of PHPRPC!
So, let's take a look at how to use PHPRPC 3.0 to compile ajax applications.
The following is a simple example (or even a boring example: mrgreen:) to illustrate how to use PHPRPC 3.0 to write ajax applications. This example shows how the MVC pattern mentioned above works. Here we will take the PHP Server as an example. The first example is simple. the client inputs a string and the server calculates its SHA1 value.
Copy codeThe code is as follows:
Require_once ("../php/phprpc_server.php ");
$ Server = new PHPRPC_Server ();
$ Server-> add ("sha1 ");
$ Server-> start ();
?>
With such a simple 4-line code, PHP's built-in sha1 function is released. Now, the client can directly use this function.
Copy codeThe code is as follows:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service