对一个排序输出调用两个类函数


calling two classes functions to one sorted output

im在index.php文件中冲浪,我的代码是:

index.php=

require("template.php"); // the file with the template of the site
$title="Home";
$phead='';
$html->htmlhead();
$htmlside="";
$html->htmlside();
require("file2.php"); // a file with class $queans and function question()
$htmlbody = $queans->questions();
$html->htmlbody($htmlbody);
$htmlfoot="";
$html->htmlfoot();

template.php=包含类$html和我在上一个文件中编写的所有it函数。以及具有htmlbody功能的spific proflem:

//all the class plugin
//in this specific function i wrote
$html->htmlbody($htmlbody){
   echo '<div id="s">'.$htmlbody.'</div>';
}

file2.php=

$queans = new ques;
class ques{
    public function questions(){
        echo 'test';
    }
}

最后,它显示了$queans->questions()的输出在function questions()的输出之前,输出如下:

test
<div id="s">
</div>

在file2.php中,您必须返回"test"而不是回显它。