Where to put http get function in CodeIgniter
I understand that everything dealing wi开发者_如何学Cth database should be put inside a model class. But what about the data I get from a HTTP GET resource, like say a xml file, csv file or something like that. Should I make a helper for it? a library? or is it good in a model?
Regards
Models should be used for anything involving data retrieval or storage, that includes calling webservices, queries, loading and parsing xml.
Then again this is just a suggestion, you could leave it all in your controller or use a library and it would make no difference other than that you're not conforming to MVC principles.
Yeah, if you are going to store the data from the GET resource in the database then using a model to process the data is definitely the way to go.
精彩评论