0

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 .

1 Answer 1

1

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;
Sign up to request clarification or add additional context in comments.

1 Comment

thnx bro i fix it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.