club_singer.php

来自「Professional PHP5 code for this book」· PHP 代码 · 共 33 行

PHP
33
字号
<?phprequire_once("class.Collection.php");class Singer {  public $name;    public function __construct($name) {    $this->name = $name;  }}class NightClub {  public $name;  public $singers;    public function __construct($name) {    $this->name = $name;    $this->singers = new Collection();    $this->singers->setLoadCallback('_loadSingers', $this);  }    private function _loadSingers(Collection $col) {    print "(We're loading the singers!)<br>\n";    //these would normally come from a database    $col->addItem(new Singer('Frank Sinatra'));    $col->addItem(new Singer('Dean Martin'));    $col->addItem(new Singer('Sammy Davis, Jr.'));  }}?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?