2008年10月31日星期五

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

Matthew Weier O'Phinney-3 wrote:
>
> -- 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/
>
>
exactly
thanks
--
View this message in context: http://www.nabble.com/namefile.json-from-Zend_Dojo_Data-tp20266827p20269745.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: