url = $par1; $this->title = $par2; } function getUrl() { echo $this->url . PHP_EOL; } function getTitle() { echo $this->title . PHP_EOL; } } $twle = new Site('www.twle.cn','简单编程'); $taobao = new Site('www.taobao.com','淘宝'); $baidu = new Site('www.baidu.com', '百度'); // 调用成员函数,获取标题和 URL $twle->getTitle(); $taobao->getTitle(); $baidu->getTitle(); $twle->getUrl(); $taobao->getUrl(); $baidu->getUrl(); echo '

PHP 基础教程 - 简单教程(www.twle.cn)

';