zend framework控制器点击提交 指定的网页无法访问 测试获取表单的数组能够正常输出 表模型也没错

WBOY
Release: 2016-06-23 14:14:51
Original
820 people have browsed it



点击提交后
您指定的网页无法访问! 
错误类型: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个星期.

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!