LifeSoCool
LifeSoCool

Reputation: 11

PHP ZEND create URL with Json value

I am in a CONTROLLER and a ACTION, from a database query execution, and now returns a ARRAY (I want to transfer this data). Now I want to pass this data to a front FLASH (JSON format) with URL. Like URL is / controller/action/new/id/1/, how do this? how can i create url to transfer this value??

Upvotes: 1

Views: 154

Answers (1)

RockyFord
RockyFord

Reputation: 8519

I don't know if you actually need JSON for your purposes but if you do you can convert an array to JSON:

//should work for most objects as well
$array  = array();
$data = Zend_Json::encode($array);
//make the json human readable if required
$pretty = Zend_Json::prettyPrint($data,array($options = NULL))<br />

Zend_Json:: Ref
This simplest (but not the only way) way to send information in a url in ZF is to use _forward:
Zend_Controller_Action() Utility Methods

$this->_forward('action', 'controller', 'module', array('key' => 'value');

the default for 'controller' and 'module' are null

Upvotes: 1

Related Questions