2017-02-13 41 views
2

我有一個表單,我使用POST發佈到HTTP標頭。我想print_r的變量,但我不知道如何作爲變量在數組中的數組。Silverstripe - 檢索陣列中的POST陣列

print_r($ _ POST);給我

Array ([y] => Array ([0] => 124) [x] => Array ([0] => 02:23PM)) 

我的代碼:

public function index(SS_HTTPRequest $request) { 

    if($request->postVars(y)) { 
     print_r ($request);   
    } 
} 

我知道我失去了一些東西,但不知道它是什麼。

回答

3

您正在使用postVars,它給你全部後變量。你想得到一個postVar,是這樣的: $request = $this->getRequest(); Debug::dump($request->postVar('x'));

+0

非常感謝你 – Craig