2008年10月31日星期五

Re: [fw-mvc] namefile.json from Zend_Dojo_Data

-- Alessandro Camilli <alex_cam@libero.it> wrote
(on Friday, 31 October 2008, 07:15 AM -0700):
> what is the best way to create a new file in the server using dojo_data?
>
> Example:
> $data = new Zend_Dojo_Data();
> $data->setIdentifier('name');
> $data->setLabel('label');
> $data->addItems(array(
> array('name'=> 'name01', 'label'=>'label01'),
> array('name'=> 'name02', 'label'=>'label02'),
> array('name'=> 'name03', 'label'=>'label03'),
> ));
>
> I'd like to create a new file ics.json within $data in the path
> of the server /public/user/ics.json.

The way I'm reading your request is that you want to dump the results of
Zend_Dojo_Data to the file 'ics.json'? If so, simply do the following:

file_put_contents('path/to/ics.json', $data->toJson());

--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/

没有评论: