2010-07-09 13 views
0

我有一個後端PHP腳本發送信息給as3應用程序。我發送的是Json信息,我做了什麼使它成爲一個關鍵值對就是在它前面粘上一個等號和一個關鍵字,然後發送它。它適用於較小的值,但由於某種原因,它不適用於此,繼承了代碼,我希望你們可以提供幫助。謝謝:)AS3中的鍵值對

c3po=[{"in_reply_to_status_id":null,"favorited":false,"contributors":null,"truncated":false,"source":"API<\/a>","created_at":"Fri Jul 09 23:15:29 +0000 2010","coordinates":null,"in_reply_to_screen_name":null,"in_reply_to_user_id":null,"user":{"profile_background_image_url":"http:\/\/a1.twimg.com\/profile_background_images\/100564626\/hexagons-twtr.jpg","description":"Graphic\/web designer and blogger founder of abduzeedo","location":"Porto Alegre","profile_sidebar_fill_color":"d9f0fd","profile_image_url":"http:\/\/a3.twimg.com\/profile_images\/555183361\/avatar-hair_normal.jpg","profile_background_tile":true,"statuses_count":7520,"profile_sidebar_border_color":"c4c4c4","screen_name":"abduzeedo","lang":"en","profile_use_background_image":true,"created_at":"Mon Dec 04 23:31:20 +0000 2006","followers_count":54252,"contributors_enabled":false,"friends_count":407,"geo_enabled":true,"profile_background_color":"000000","following":false,"favourites_count":114,"protected":false,"verified":false,"profile_text_color":"525252","name":"Fabio Sasso","time_zone":"Brasilia","url":"http:\/\/www.abduzeedo.com","id":41553,"notifications":false,"utc_offset":-10800,"profile_link_color":"2d68a9"},"place":null,"geo":null,"id":18154410176,"retweeted_status":{"in_reply_to_status_id":null,"favorited":false,"contributors":null,"truncated":false,"source":"feedly<\/a>","created_at":"Fri Jul 09 22:57:03 +0000 2010","coordinates":null,"in_reply_to_screen_name":null,"in_reply_to_user_id":null,"user":{"profile_background_image_url":"http:\/\/a3.twimg.com\/profile_background_images\/47193661\/curses_.png","description":"Degree in architecture and working with web.","location":"Porto Alegre, Brasil","profile_sidebar_fill_color":"bed3d4","profile_image_url":"http:\/\/a3.twimg.com\/profile_images\/554722981\/fabianome_normal.png","profile_background_tile":false,"statuses_count":2602,"profile_sidebar_border_color":"8cbdba","screen_name":"FabianoMe","lang":"en","profile_use_background_image":false,"created_at":"Thu Mar 27 21:07:04 +0000 2008","followers_count":1807,"contributors_enabled":false,"friends_count":191,"geo_enabled":true,"profile_background_color":"1a1107","following":true,"favourites_count":9,"protected":false,"verified":false,"profile_text_color":"25140d","name":"Fabiano Meneghetti","time_zone":"Brasilia","url":"http:\/\/fabiano.me","id":14238754,"notifications":false,"utc_offset":-10800,"profile_link_color":"d1242a"},"place":null,"geo":null,"id":18153403793,"text":"Beautiful Houses: Cliff House in Kerala, India http:\/\/bit.ly\/aAGjcb - via @GisMullr"},"text":"RT @FabianoMe: Beautiful Houses: Cliff House in Kerala, India http:\/\/bit.ly\/aAGjcb - via @GisMullr","percent":25}]

回答

0

是否有值的新行?這可能是一個問題,取決於你使用/閱讀關鍵值的方式。也許如果你發佈了訪問這些值的AS3應用程序的部分,我可以提供更多的見解。

1

如果您使用的是JSON,那麼您是不是可以放棄該鍵並僅返回JSON數據?這對我來說更有意義。

從您的actionscript代碼中,您可以加載數據,將URLLoader dataFormat屬性設置爲URLLoaderDataFormat.TEXT,並將響應數據解析爲JSON。

否則,也許rawurlencode(),如果你ghave鄰與鍵可以幫助/值的方法因某些原因:

$json_data = ''; // your current data goes here 
echo 'c3po=' . rawurlencode($json_data); 
+0

THANK YOU SO MUCHHH,我還以爲UrlLoaderDataFormat是你送什麼,NOTTT什麼你收到了,謝謝你很多 – 2010-07-10 05:35:48

+0

@帕特里克蓋茨。別客氣! – 2010-07-10 16:45:46