2013-02-04 150 views
0

爲Zend2框架蔭新的傢伙...我得到它,我沒有跟蹤它的錯誤...服務器沒有收到迴應/ SendRequests

蔭寫了一個名爲「usertask」控制器和在冷杉指數函數我寫了這樣的代碼

public function indexAction() 
{ 
    $sendRequest = new SendRequests; 
    $tableGrid = new DynamicTable(); 

    $prop = array(
     'customRequest' => 'GET', 
     'headerInformation' => array('environment: development', 'token_secret: abc') 
    ); 
    $returnRequest = $sendRequest->set($prop)->requests('http://service-api/usertask'); 

    $returnData = json_decode($returnRequest['return'],true);   


    $tableGrid->tableArray = $returnData['result'];     
    $dynamicTable = $tableGrid->tableGenerate();     

    $view = new ViewModel(array(
       'usertask' => $dynamicTable 
      )); 
    //print_r($view);exit; 

    return $view; 
} 

,但它不是我的上市... usertasks而打印的IAM $ returnRequest它給我的錯誤信息像

The server don't receive a Response/SendRequests 

它在我的代碼錯誤...腠LD人...... please..iam使用「zend2」

回答

0

對不起球員,我發現我的錯誤提示我...我得到很大的代碼,但我需要這樣的東西

public function indexAction() 
{       
    $view = new ViewModel(array(
      'usertask' => $this->UserTable()->fetchall(), 
     )); 

    return $view; 
} 
public function getUserTable() 
{ 
    if (!$this->userTable) { 
     $sm = $this->getServiceLocator(); 
     $this->userTable = $sm->get('User\Model\UserTable'); 
    } 
    return $this->userTable; 
} 

就是這樣...我把它當作用戶列表