{"id":6906,"date":"2015-03-13T17:43:58","date_gmt":"2015-03-13T09:43:58","guid":{"rendered":"http:\/\/jpuyy.com\/?p=6906"},"modified":"2016-09-30T10:57:53","modified_gmt":"2016-09-30T02:57:53","slug":"codeigniter-model-view-controller","status":"publish","type":"post","link":"https:\/\/jpuyy.com\/?p=6906","title":{"rendered":"Model-View-Controller"},"content":{"rendered":"<p>Model-View-Controller<\/p>\n<p>CodeIgniter is based on the Model-View-Controller development pattern. MVC is a software approach that separates application logic from presentation. In practice, it permits your web pages to contain minimal scripting since the presentation is separate from the PHP scripting.<\/p>\n<p>The\u00a0Model\u00a0represents your data structures. Typically your model classes will contain functions that help you retrieve, insert, and update information in your database.<br \/>\nThe\u00a0View\u00a0is the information that is being presented to a user. A View will normally be a web page, but in CodeIgniter, a view can also be a page fragment like a header or footer. It can also be an RSS page, or any other type of &#8220;page&#8221;.<br \/>\nThe\u00a0Controller\u00a0serves as an\u00a0intermediary\u00a0between the Model, the View, and any other resources needed to process the HTTP request and generate a web page.<\/p>\n<h1 style=\"color: #e13300; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #666666; background-color: #ffffff; font-weight: normal; font-size: 24px; margin: 0px 0px 20px; padding: 3px 0px 7px 3px; font-family: 'Lucida Grande', Verdana, Geneva, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;\"><\/h1>\n<div><\/div>\n<div>CodeIgniter has a fairly loose approach to MVC since Models are not required. If you don&#8217;t need the added separation, or find that maintaining models requires more complexity than you want, you can ignore them and build your application minimally using Controllers and Views. CodeIgniter also enables you to incorporate your own existing scripts, or even develop core libraries for the system, enabling you to work in a way that makes the most sense to you.<\/div>\n<div><\/div>\n<div><\/div>\n<div>\n<ul style=\"margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-right: 5px; padding-bottom: 5px; font-size: 0.76em; font-family: Simsun; text-align: left; background-color: #ffffff;\">\n<li style=\"font-family: arial, nsimsun, sans-serif; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-right: 5px; padding-bottom: 3px;\"><em>\u6a21\u578b<\/em>\u00a0\u5305\u542b\u4e0e\u60a8\u7684\u6570\u636e\u5e93\u548c\u5176\u4ed6\u6570\u636e\u7ed3\u6784\u76f8\u5173\u7684\u6240\u6709\u4ee3\u7801\u3002\u5982\u679c\u60a8\u5177\u6709\u4e00\u4e2a\u540d\u4e3a pages \u7684\u8868\uff0c\u5219\u60a8\u5177\u6709\u4e00\u4e2a\u6a21\u578b\uff0c\u5176\u4e2d\u5177\u6709\u7528\u4e8e\u4ece\u8868\u4e2d\u9009\u62e9\u3001\u521b\u5efa\u3001\u66f4\u65b0\u548c\u5220\u9664\u8bb0\u5f55\u7684\u51fd\u6570\u3002<\/li>\n<li style=\"font-family: arial, nsimsun, sans-serif; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-right: 5px; padding-bottom: 3px;\"><em>\u89c6\u56fe<\/em>\u00a0\u5305\u542b\u6240\u6709\u663e\u793a\u548c UI \u5143\u7d20 \u2014 JavaScript \u4ee3\u7801\u3001Cascading Style Sheets (CSS)\u3001HTML \u751a\u81f3 PHP\u3002<\/li>\n<li style=\"font-family: arial, nsimsun, sans-serif; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-right: 5px; padding-bottom: 3px;\"><em>\u63a7\u5236\u5668<\/em>\u00a0\u5c06\u4e00\u5207\u8054\u7cfb\u5728\u4e00\u8d77\u3002\u63a7\u5236\u5668\u4e2d\u7684\u6bcf\u4e2a\u51fd\u6570\u8868\u793a\u4e00\u4e2a\u76ee\u7684\u5730\u6216\u8def\u7ebf\u3002\u5982\u679c\u60a8\u5177\u6709\u4e00\u4e2a\u540d\u4e3a \/about \u7684\u76ee\u7684\u5730\uff0c\u5219\u63a7\u5236\u5668\u5c06\u5177\u6709\u4e00\u4e2a\u540d\u4e3a\u00a0<code style=\"font-size: small !important;\">about()<\/code>\u00a0\u7684\u51fd\u6570\u3002<\/li>\n<\/ul>\n<\/div>\n<div><\/div>\n<div><a href=\"http:\/\/www.ibm.com\/developerworks\/cn\/web\/wa-codeigniter\/index.html\">http:\/\/www.ibm.com\/developerworks\/cn\/web\/wa-codeigniter\/index.html<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Model-View-Controller CodeIgniter is based on the Model-View-Controller development pattern. MVC is a software approach that separates application logic from presentation. In practice, it permits your web pages to contain minimal scripting since the presentation is separate from the PHP scripting. The\u00a0Model\u00a0represents your data structures. Typically your model classes will contain functions that help you retrieve, [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[64],"tags":[],"class_list":["post-6906","post","type-post","status-publish","format-standard","hentry","category-web"],"_links":{"self":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/6906","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6906"}],"version-history":[{"count":2,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/6906\/revisions"}],"predecessor-version":[{"id":7225,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/6906\/revisions\/7225"}],"wp:attachment":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6906"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6906"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6906"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}