代码改变世界

用xdebug调试zend framework 看路径对应的数组 主控 分控

2012-07-27 15:42  java环境变量  阅读(324)  评论(0编辑  收藏  举报

 

错误如下

——————————————————————————————————————————————————————————————————

( ! ) Zend_Controller_Dispatcher_Exception: Invalid controller specified (myvote) in F:\xampp\htdocs\zendfrm\library\Zend\Controller\Dispatcher\Standard.php on line 248 Call Stack #TimeMemoryFunctionLocation 10.0182344544{main}( )..\index.php:0 2137.12923630496Zend_Application->run( )..\index.php:26 3137.12923630496Zend_Application_Bootstrap_Bootstrap->run( )..\Application.php:366 4137.12943630552Zend_Controller_Front->dispatch( ???, ??? )..\Bootstrap.php:97 5137.15464941456Zend_Controller_Dispatcher_Standard->dispatch( object(Zend_Controller_Request_Http)[17], object(Zend_Controller_Response_Http)[18] )..\Front.php:954

An error occurred

Page not found

Exception information:

Message: Invalid controller specified (myvote)

Stack trace:

#0 F:\xampp\htdocs\zendfrm\library\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#1 F:\xampp\htdocs\zendfrm\library\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch()
#2 F:\xampp\htdocs\zendfrm\library\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#3 F:\xampp\htdocs\zendfrm\public\index.php(26): Zend_Application->run()
#4 {main}  

http://localhost/myvote/application/views/scripts/admin/additemui.phtml?XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=13433742764532

Request Parameters:

array (
  'controller' => 'myvote',
  'action' => 'application',
  'views' => 'scripts',
  'admin' => 'additemui.phtml',
  'module' => 'default',
  'XDEBUG_SESSION_START' => 'ECLIPSE_DBGP',
  'KEY' => '13433742764532',
)  

 

代码如下:

——————————————————————————————————————————————————————————————————

<?php
require_once 'BaseController.php';
require_once APPLICATION_PATH.'/models/Item.php';
/**
 * 专门管理后台
 * Enter description here ...
 * @author harry_manage_top_100
 *
 */
class AdminController extends BaseController
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        // action body
    }

   
    //进入增加选项的页面
    public  function additemuiAction(){
     //没有写就相当于有下面的语句,如果不想用这个控制器 forward  redirect
     $this->render('additemui');
    }
    //完成一个添加的任务
  public  function additemAction(){
     //没有写就相当于有下面的语句,如果不想用这个控制器 forward  redirect
     /*echo 'harry';
     exit();*/
   $name=$this->getRequest()->getParam('name');
   $description=$this->getRequest()->getParam('description');
   $vote_count=$this->getRequest()->getParam('vote_count');
   
/*       
    echo  $name,$description,$vote_count;
   
   echo APPLICATION_PATH.'/models/Item.php';
   exit();*/
 
 
   $data=array(
           'name'=>$name,
          'description'=>$description,
        'vote_count'=>$vote_count
   );
   //创建一个表模型对象
   $itemModel=new Item();
   $itemModel->insert($data);
   $this->render('ok');
   
    }
}