开发者

Zend framework Json engine?

开发者 https://www.devze.com 2022-12-22 21:25 出处:网络
Is there some kind a engine for Json in the Zend framework, What I mean is some abstraction that all the Json (ajax)开发者_运维知识库 responces go through ?

Is there some kind a engine for Json in the Zend framework, What I mean is some abstraction that all the Json (ajax)开发者_运维知识库 responces go through ? in other words some class to controll all the Ajax calls?


Zend_Json_Server - JSON-RPC server might do what you are looking for:

Zend_Json_Server is a » JSON-RPC server implementation. It supports both the » JSON-RPC version 1 specification as well as the » version 2 specification; additionally, it provides a PHP implementation of the » Service Mapping Description (SMD) specification for providing service metadata to service consumers.

Apart from that, there is also Zend_JSON, that

provides convenience methods for serializing native PHP to JSON and decoding JSON to native PHP. […] In addition, Zend_Json provides a useful way to convert any arbitrary XML formatted string into a JSON formatted string. This built-in feature will enable PHP developers to transform the enterprise data encoded in XML format into JSON format before sending it to browser-based Ajax client applications.

Also see these articles by

  • Matthew Weier O'Phinney on Responding to Different Content Types in RESTful ZF Apps and
  • Ciaran McNulty on Clarifying Javascript-PHP communication using JSON-RPC


Your question is a little vague and could be interpreted in two ways.

a. You are just trying to serve ajax actions through your controllers.

This is pretty simple to achieve using the context switch action helper

b. You want to serve JSON responses via an API, whether it be to use internally or externally.

If that is the case, Zend_Rest_Controller is probably the direction you want to go in.

I hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消