时间:2021-07-01 10:21:17 帮助过:27人阅读
代码如下:
abstract class postParent
{
protected $querySQL;
public $fetchResult;
public $timeAgo; // eg : 2 days ago
abstract protected function buildHTML();
public function getSQL()
{
return $this->querySQL;
}
public function fetchResult( $result )
{
$this->fetchResult = mysql_fetch_assoc( $result );
}
public function error()
{}
}
class readArticle extends postParent
{
public function __construct( $id )
{
$this->querySQL =<<
WHERE id = $id ORDER BY unixtime DESC;
eof;
}
public function buildHTML()
{
return <<
fetchResult['id']}"
class="post-title-a" > {$this->fetchResult['title']}
{$this->fetchResult['author']} at
{$this->fetchResult['text']}
eof;
}
}
以上就介绍了抽象类 php 抽象类的简单应用,包括了抽象类方面的内容,希望对PHP教程有兴趣的朋友有所帮助。