在 myClass 我已经宣布$_total_results_found = 0
然后在我的函数中我改变了$_total_results_found = 10
但是,当我尝试在 myClass 之外调用它时,值仍然显示为 0。
请任何人帮助我如何编写这段代码?
class myClass
{
private $_total_rows_count = 0;
public function foundResults()
{
$count = 10;
$this->_total_rows_count = $count;
}
} // end myClass
$myclass = new myClass();
echo $myclass->_total_results_found; // Value is showing 0 instead of 10