因此,這裏是一個方法,我在我的控制器:法「_getTable」不存在,並沒有被困在__call()
private $_tables = array();
private function _getTable($table)
{
if (!isset($this->_tables[$table])) {
include APPLICATION_PATH . '/modules/'
. $this->_request->getModuleName() . '/models/' . $table . '.php';
$this->_tables[$table] = new $table();
}
return $this->_tables[$table];
}
我使用像這樣的控制器操作:
public function pageAction()
{
$request = $this->getRequest();
$pages = $this->_getTable('Pages');
$p = $pages->getSingle($request->getParam('id'));
// increment number of views in the database
// it only gets incremented when IP is not the same
// as last viewer's IP
$pages->viewIncrement($p->id);
$this->view->headTitle($p->title
. ' - Some cool title');
$this->view->p = $p;
}
在我的PC上進行測試時,它在localhost上效果很好。它還曾我年長的虛擬主機上,但最近我提出我的ZF應用到一個新的網站託管服務提供商和瀏覽某些網頁時,我得到這個錯誤:
Method "_getTable" does not exist and was not trapped in __call()
這是所有這一切顯示,沒有別的。有些頁面可以工作,有些顯示這個錯誤,所以我完全失去了。可能是什麼問題呢?
所有必需的PHP擴展都已正確安裝和配置,數據庫連接正常工作(因爲有些頁面可以正常工作)。我真的不知道。如果至少這個錯誤更具描述性。
什麼PHP版本正在您的新主機上使用? – smack0007 2010-02-22 15:20:52
它是PHP版本5.2.6-1。 – 2010-02-22 16:11:32