In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how to use Json in Zend Framework. It is very detailed and has a certain reference value. Friends who are interested must finish it!
The details are as follows:
Json is relatively simple to use, and the following is the usage given in the document:
Json is used to decode and send JSON responses
When processing an AJAX request that expects the data table to respond, the JSON response quickly becomes the selected response.
JSON can be parsed immediately on the client side for quick execution.
The JSON Action Assistant completes the following tasks:
If the layout is open (enabled), close it (disable).
If the view parser (ViewRenderer) is open, close it.
Set the 'Content-Type' response header' to 'application/json'.
By default, you don't need to wait for the action to complete and return the response immediately.
The usage is simple: either call it as a method of the helper proxy, or call one of the encodeJson () and sendJson () methods:
Class FooController extends Zend_Controller_Action {public function barAction () {/ / do some processing... / / Send the JSON response: $this- > _ helper- > json ($data); / / or... $this- > _ helper- > json- > sendJson ($data); / / or retrieve the json: $json = $this- > _ helper- > json- > encodeJson ($data);}}
Note: keep layout (Keeping Layouts)
If you have a separate layout for the JSON response-perhaps encapsulating the JSON into some context-accept the second optional parameter in each method of the JSON helper: turn the layout's flag on or off, passing a Boolean true value will keep the layout open:
Class FooController extends Zend_Controller_Action {public function barAction () {/ / Retrieve the json, keeping layouts: $json = $this- > _ helper- > json- > encodeJson ($data, true);}} these are all the contents of the article "how to use Json in Zend Framework". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.