在PHP中使用ASP.NET AJAX
在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();

Heiße KI -Werkzeuge

Undresser.AI Undress
KI-gestützte App zum Erstellen realistischer Aktfotos

AI Clothes Remover
Online-KI-Tool zum Entfernen von Kleidung aus Fotos.

Undress AI Tool
Ausziehbilder kostenlos

Clothoff.io
KI-Kleiderentferner

AI Hentai Generator
Erstellen Sie kostenlos Ai Hentai.

Heißer Artikel

Heiße Werkzeuge

Notepad++7.3.1
Einfach zu bedienender und kostenloser Code-Editor

SublimeText3 chinesische Version
Chinesische Version, sehr einfach zu bedienen

Senden Sie Studio 13.0.1
Leistungsstarke integrierte PHP-Entwicklungsumgebung

Dreamweaver CS6
Visuelle Webentwicklungstools

SublimeText3 Mac-Version
Codebearbeitungssoftware auf Gottesniveau (SublimeText3)

Heiße Themen

