<?php
// 使用 interface 用於定義接口,首先說明接口的,用於聲明基本接口,interface關鍵字定義接口
// 但是其中所有的方法都是空的,實現其中的方法需要在"類"中實現。
// 接口定義的所有方法都是公開的,這是接口的基本特性
interface hello{
public function say1_0($a);
public function say1_1($b);
}
// 實現接口需要在具體類中實現,需要使用
class hello_1 implements hello{ // 注意實現類不能與接口名重名
public function say1_0($a)
{
// TODO: Implement say_0() method.
echo "hello";
}
public function say1_1($b)
{
// TODO: Implement say_1() method.
echo "天安門";
}
}
?>