( ! ) Warning: Invalid argument supplied for foreach() in F:\xampp\htdocs\zendfrm\application\views\

来源:互联网 发布:exm网络意思 编辑:程序博客网 时间:2024/05/16 00:57

( ! ) Warning: Invalid argument supplied for foreach() in F:\xampp\htdocs\zendfrm\application\views\scripts\index\index.phtml on line46Call Stack#TimeMemoryFunctionLocation10.0025340224{main}( )..\index.php:020.05123626240Zend_Application->run( )..\index.php:2630.05123626240Zend_Application_Bootstrap_Bootstrap->run( )..\Application.php:36640.05143626296Zend_Controller_Front->dispatch( ???, ??? )..\Bootstrap.php:9750.06894936608Zend_Controller_Dispatcher_Standard->dispatch( object(Zend_Controller_Request_Http)[17],object(Zend_Controller_Response_Http)[18] )..\Front.php:95460.08505283280Zend_Controller_Action->dispatch( string(11) )..\Standard.php:29570.08535286600IndexController->indexAction( )..\Action.php:51680.10335725992Zend_Controller_Action->render( string(5), ???, ??? )..\IndexController.php:2990.10375726216Zend_Controller_Action_Helper_ViewRenderer->render( string(5),null, bool )..\Action.php:212100.10605726352Zend_Controller_Action_Helper_ViewRenderer->renderScript( string(17), null )..\ViewRenderer.php:921110.10615726352Zend_View_Abstract->render( string(17) )..\ViewRenderer.php:900120.10725767528Zend_View->_run( string(67) )..\Abstract.php:888130.10775771416include( 'F:\xampp\htdocs\zendfrm\application\views\scripts\index\index.phtml' )..\View.php:108

( ! ) Notice: Array to string conversion in F:\xampp\htdocs\zendfrm\application\controllers\IndexController.php on line24

Call Stack

#

Time

Memory

Function

Location

1

0.0025

340224

{main}( )

..\index.php:0

2

0.0512

3626240

Zend_Application->run( )

..\index.php:26

3

0.0512

3626240

Zend_Application_Bootstrap_Bootstrap->run( )

..\Application.php:366

4

0.0514

3626296

Zend_Controller_Front->dispatch( ???, ??? )

..\Bootstrap.php:97

5

0.0689

4936608

Zend_Controller_Dispatcher_Standard->dispatch( object(Zend_Controller_Request_Http)[17],object(Zend_Controller_Response_Http)[18] )

..\Front.php:954

6

0.0850

5283280

Zend_Controller_Action->dispatch( string(11) )

..\Standard.php:295

7

0.0853

5286600

IndexController->indexAction( )

..\Action.php:516

 

 

将控制器中的 $this->view->$res=$res;  改为$this->view->res=$res;  它就像个session  赋与其名即可

  //控制器中的一个函数
    public function indexAction()
    {
        // action body
        file_put_contents("d:/mylog.txt", __FILE__.date('y-m-d h:i:s')."index..\r\n",FILE_APPEND);
        //如果什么都没有些,相当于有以下一句话;用view/scripts/index/index.phtml
        $messageModel=new Message();
        $res=$messageModel->fetchAll()->toArray();
        //怎样把控制器获取的数据 array  object  int
        $this->view->res=$res;
       /* echo '<pre>';
        print_r($res);
        echo '</pre>';
        */
        $this->render('index');
    }

原创粉丝点击