All right,父类postParent定义为抽象,规定子类必须重新实现 buildHTML()方法,这个方法并没有花括号,如果有不管有没有内容都会报错的。
现在越看越觉得这代码完全没必要用抽象类,用继承也都很鸡肋,好吧,也没啥好说的好像。。。。。
另外我把MysqL 分开在外面了,所以调用方法很麻烦
1,先实例化 readArticle
2,mySQL查询,参数来自 readArticle::getsql();
3,返回MysqL结果资源给 readArticle::fetchResult( $result );
4,readArticle::buildHTML(); 返回HTML
如果是列表循环输出的话,把 3 和 4 重复调用就可以了
<div class="codetitle"><a style="CURSOR: pointer" data="26203" class="copybut" id="copybut26203" onclick="doCopy('code26203')"> 代码如下: