Zend Framework, Flex & PHP – Best Practice Cautions

Hey guys,

recently me and my flex developer colleague had a weird problem while exchanging data from zend framework to flex as web services using json.

well, 1st caution :

don’t ever use a closing tag ” ?> ” in your controllers or classes, as it will result in new line in the output json data, which will make flex not able to recognize it correctly.

2nd caution :

when u echo output from php don’t leave space between the variable and the equal “=” sign and also between the equal “=” sign and the value.
to be clear :
example 1 :

This won’t work as flex will not recognize a value for the variable Json.
example 2 :

This will work because we removed the spaces.

hope u don’t fall in this trap as we did.
& enjoy 😉

Leave a Reply

avatar
  Subscribe  
Notify of