的index.php調用一個成員函數COUNT()一個非對象在
$user= DB::getInstance()->get('users',array('user_id','=','1'));
if(!$user->Count()){
echo 'No User';
}else{
echo 'User Exists';
}
db.php中
class DB {
private static $_instance = null;
private $_pdo,
$_query,
$_error = false,
$_results,
$_count = 0;
public function Count(){
return $this->_count;
}
}
get函數
class Yapilandirma{
public static function get($yol = null){
if($yol){
$yapilandirma = $GLOBALS['yapilandirma'];
$yol = explode('/',$yol);
foreach($yol as $bit){
if(isset($yapilandirma[$bit])) {
$yapilandirma = $yapilandirma[$bit];
}
}
return $yapilandirma;
}
return false;
}
}
我檢查了其他15 +主題具有相同的標題,但我無法解決它。需要添加更多的細節發佈仍然希望細節omg。
我在這裏找到答案。 http://stackoverflow.com/questions/33162167/fatal-error-call-to-a-member-function-count-on-a-non-object-in-not-solved?rq=1 – Creative3