zend framework控制器點擊提交 指定的網頁無法訪問 測試擷取表單的數組能夠正常輸出 表模型也沒錯

來源:互聯網
上載者:User
點擊提交後
您指定的網頁無法訪問!
錯誤類型:500

控制器代碼
public function additemAction(){
$name=$this->getRequest()->getParam('name');
$description=$this->getRequest()->getParam('description');
$vote_count=$this->getRequest()->getParam('vote_count');

/*
echo $name,$description,$vote_count;

exit();*/


$data=array(
'name'=>$name,
'description'=>$description,
'vote_count'=>$vote_count
);


$itemModel=new Item();
$itemModel->insert($data);
$this->redirect('ok');
}



Item.php

//這裡必須繼承Zend_Db_Table,否則就不是表模型
class Item extends Zend_Db_Table{
//預設主鍵為id 可以不寫
protected $_primary='id';
protected $_name='item';


}


回複討論(解決方案)

你資料庫有沒有配置的?

"指定的網頁無法訪問"是不是提交的路徑有問題呢?

$this->_redirect('ok');

請問問題解決了嗎?我也有同樣的問題.

同問,請大師求解

兄弟們,俺終於發現原因了
就是mysql裡的item表裡某個欄位名拼字錯了,就會造成這樣的結果
俺的就是description在item表裡寫成 descrption,差了一個字母i
整整搞了1個星期.

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.