在PHP中使用ASP.NET AJAX
编写Service文件
新建一个php文件,命名为EmployeeService.php。首先写上这一句,include必要的支持代码:
require_once 'MSAjaxService.php';
然后定义一个Employee类。四个属性一目了然,不用多说:
class Employee
{
public $Id;
public $Name;
public $Email;
public $Salary;
function __construct($id, $name, $email, $salary)
{
$this->Id = $id;
$this->Name = $name;
$this->Email = $email;
$this->Salary= $salary;
}
}
接下来是EmployeeService类,继承与MSAjaxService.php中的MSAjaxService基类。其中定义一个方法,用来返回一个Employee对象:
class EmployeeService extends MSAjaxService
{
function GetEmployee()
{
return new Employee(12345, "Dflying Chen", "Dflying@some.com", 1000);
}
}
然后新建一个EmployeeService的实例,并且调用基类的ProcessRequest()方法,处理该请求:
$theService = new EmployeeService();
$theService->ProcessRequest();

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

PhpStorm Mac 版本
最新(2018.2.1 )专业的PHP集成开发工具

适用于 Eclipse 的 SAP NetWeaver 服务器适配器
将Eclipse与SAP NetWeaver应用服务器集成。

SublimeText3 英文版
推荐:为Win版本,支持代码提示!

Atom编辑器mac版下载
最流行的的开源编辑器

Dreamweaver Mac版
视觉化网页开发工具