国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 開發(fā) > AJAX > 正文

在PHP中使用ASP.NET AJAX

2024-09-01 08:30:04
字體:
供稿:網(wǎng)友

  編寫Service文件


  新建一個(gè)php文件,命名為EmployeeService.php。首先寫上這一句,include必要的支持代碼:

以下為引用的內(nèi)容:
require_once 'MSAjaxService.php';

  然后定義一個(gè)Employee類。四個(gè)屬性一目了然,不用多說:

以下為引用的內(nèi)容:
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基類。其中定義一個(gè)方法,用來返回一個(gè)Employee對(duì)象:

以下為引用的內(nèi)容:
class EmployeeService extends MSAjaxService
{
function GetEmployee()
{
return new Employee(12345, "Dflying Chen", "Dflying@some.com", 1000);
}
}

  然后新建一個(gè)EmployeeService的實(shí)例,并且調(diào)用基類的ProcessRequest()方法,處理該請(qǐng)求:

以下為引用的內(nèi)容:
$theService = new EmployeeService();
$theService->ProcessRequest();

  大功告成!

  請(qǐng)作者聯(lián)系本站,及時(shí)附注您的姓名。聯(lián)系郵箱:CuoXIn#vip.qq.com(把#改為@)。

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 西平县| 阳原县| 彭阳县| 和平区| 扶沟县| 含山县| 万山特区| 张掖市| 临夏市| 甘南县| 兴业县| 红桥区| 铜鼓县| 定襄县| 邢台县| 白城市| 镇赉县| 两当县| 建水县| 竹北市| 陕西省| 盐池县| 文成县| 桦南县| 广南县| 灌南县| 武威市| 枣强县| 沂源县| 堆龙德庆县| 手机| 敦化市| 蓬安县| 远安县| 汉源县| 玉溪市| 敦化市| 高台县| 闸北区| 那曲县| 正定县|