本文介绍了在类方法中调用函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在想如何去做,但我不太确定如何去做.
I have been trying to figure out how to go about doing this but I am not quite sure how.
这是我正在尝试做的一个例子:
Here is an example of what I am trying to do:
class test {
public newTest(){
function bigTest(){
//Big Test Here
}
function smallTest(){
//Small Test Here
}
}
public scoreTest(){
//Scoring code here;
}
}
这是我遇到问题的部分,我如何调用 bigTest()?
Here is the part I am having problems with, how do I call bigTest()?
推荐答案
试试这个:
class test {
public function newTest(){
$this->bigTest();
$this->smallTest();
}
private function bigTest(){
//Big Test Here
}
private function smallTest(){
//Small Test Here
}
public function scoreTest(){
//Scoring code here;
}
}
$testObject = new test();
$testObject->newTest();
$testObject->scoreTest();
这篇关于在类方法中调用函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!