简体   繁体   中英

Get Array Element in Zend View

i pass an array to my view and i can't show element in my view ! THis is my array : Array ( [pin] => 00000 [card] => 00000 [status] => Y). thnx for helping me .

suppose you have array

 $arrayData = array ( 'pin' => 00000, 'card' => 00000, 'status' => Y);

$viewModel = new \Zend\View\Model\ViewModel();

$viewModel->setVariables($arrayData);

Now, on view you can directly access as-

$pin, $card, etc

this will add a single varibale to the view-

 $viewModel->setVariable('testVar', 'abc');

on view page, just use as

 $testVar;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM