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


( ! ) Warning: Invalid argument supplied for foreach() in F:\xampp\htdocs\zendfrm\application\views\scripts\index\index.phtml on line 46
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
8 0.1033 5725992 Zend_Controller_Action->render( string(5), ???, ??? ) ..\IndexController.php:29
9 0.1037 5726216 Zend_Controller_Action_Helper_ViewRenderer->render( string(5), null, bool ) ..\Action.php:212
10 0.1060 5726352 Zend_Controller_Action_Helper_ViewRenderer->renderScript( string(17), null ) ..\ViewRenderer.php:921
11 0.1061 5726352 Zend_View_Abstract->render( string(17) ) ..\ViewRenderer.php:900
12 0.1072 5767528 Zend_View->_run( string(67) ) ..\Abstract.php:888
13 0.1077 5771416 include( '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 line 24

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 '

';
        print_r($res);
        echo '
';
        */
        $this->render('index');
    }

你可能感兴趣的:(Zend,Framework)