在PHP中使用ASP.NETAJAX

文章作者 100test 发表时间 2007:05:12 13:49:19
来源 100Test.Com百考试题网


编写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", "[email protected]", 1000).
}
}


然后新建一个EmployeeService的实例,并且调用基类的ProcessRequest()方法,处理该请求:

$theService = new EmployeeService().
$theService->ProcessRequest().


大功告成!

相关文章


Linux系统开启Telnet服务的详细过程
提高Linux操作系统安全性的十大招数
在PHP中使用ASP.NETAJAX
Linux系统启动引导程序配置文件解析
MySQL中的mysqldump命令使用详解
Linux下登录windown系统远程桌面
让firefox浏览器自动调用下载工具
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛