{"id":76162,"date":"2024-01-10T19:16:16","date_gmt":"2024-01-10T11:16:16","guid":{"rendered":"https:\/\/www.techphant.cn\/?p=76162"},"modified":"2024-01-10T19:16:16","modified_gmt":"2024-01-10T11:16:16","slug":"mcllcjj","status":"publish","type":"post","link":"https:\/\/www.techphant.cn\/blog\/76162.html","title":{"rendered":"MVC\u5904\u7406\u6d41\u7a0b\u7b80\u4ecb"},"content":{"rendered":"

  \u4eca\u5929\u6211\u4eec\u5c06\u4ecb\u7ecdMVC\u5904\u7406\u6d41\u7a0b\uff0c\u5e76\u6df1\u5165\u63a2\u8ba8\u8be5\u6a21\u5f0f\u5728\u73b0\u4ee3\u8f6f\u4ef6\u5f00\u53d1\u4e2d\u7684\u91cd\u8981\u6027\u4e0e\u5e94\u7528\u3002<\/p>\n

Model\u5c42\u7684\u6570\u636e\u5904\u7406<\/h2>\n

  \u5728MVC\u6a21\u5f0f\u4e2d\uff0cModel\u5c42\u8d1f\u8d23\u6570\u636e\u5904\u7406\u548c\u5b58\u50a8\u3002\u8fd9\u4e00\u90e8\u5206\u5c06\u4f1a\u4ecb\u7ecdModel\u5c42\u7684\u4f5c\u7528\u3001\u5b9e\u73b0\u65b9\u5f0f\u548c\u4e0e\u540e\u7eed\u6d41\u7a0b\u7684\u5173\u8054\u3002<\/p>\n

  \u6570\u636e\u7684\u5c01\u88c5\u4e0e\u63d0\u4f9b<\/h3>\n

  Model\u5c42\u901a\u8fc7\u5c01\u88c5\u6570\u636e\uff0c\u5e76\u63d0\u4f9b\u5bf9\u6570\u636e\u7684\u57fa\u672c\u8bbf\u95ee\u548c\u64cd\u4f5c\u65b9\u6cd5\uff0c\u4ee5\u4fbf\u5728Controller\u548cView\u5c42\u4e2d\u88ab\u8c03\u7528\u3002<\/p>\n

  \u4ea4\u4e92\u5f0f\u6570\u636e\u5904\u7406<\/h3>\n

  Model\u5c42\u9700\u8981\u5904\u7406\u6765\u81eaController\u5c42\u7684\u5404\u79cd\u8bf7\u6c42\uff0c\u5e76\u6839\u636e\u9700\u8981\u8fdb\u884c\u6570\u636e\u66f4\u65b0\u3001\u5b58\u50a8\u6216\u5220\u9664\u7b49\u64cd\u4f5c\u3002<\/p>\n

View\u5c42\u7684\u6570\u636e\u5448\u73b0<\/h2>\n

  View\u5c42\u8d1f\u8d23\u6570\u636e\u7684\u5448\u73b0\u4e0e\u7528\u6237\u4ea4\u4e92\u3002\u5728\u672c\u90e8\u5206\u4e2d\uff0c\u5c06\u8be6\u7ec6\u8ba8\u8bbaView\u5c42\u7684\u529f\u80fd\u4e0e\u6570\u636e\u5904\u7406\u6d41\u7a0b\u3002<\/p>\n

  \u7528\u6237\u754c\u9762\u8bbe\u8ba1\u4e0e\u5c55\u793a<\/h3>\n

  View\u5c42\u9700\u8bbe\u8ba1\u5e76\u5c55\u793a\u7528\u6237\u754c\u9762\uff0c\u4ee5\u4fbf\u7528\u6237\u80fd\u591f\u6e05\u6670\u5730\u770b\u5230\u5e76\u64cd\u4f5c\u5e94\u7528\u7a0b\u5e8f\u4e2d\u7684\u6570\u636e\u3002<\/p>\n

  \u6570\u636e\u5c55\u793a\u4e0e\u66f4\u65b0<\/h3>\n

  View\u5c42\u4e0d\u4ec5\u9700\u8981\u5c55\u793a\u6570\u636e\uff0c\u8fd8\u9700\u6839\u636e\u7528\u6237\u64cd\u4f5c\u66f4\u65b0\u6570\u636e\uff0c\u5e76\u5c06\u76f8\u5173\u8bf7\u6c42\u53d1\u9001\u81f3Controller\u5c42\u4ee5\u5b9e\u73b0\u6570\u636e\u5904\u7406\u3002<\/p>\n

\u603b\u7ed3<\/h2>\n

  \u901a\u8fc7\u5bf9MVC\u5904\u7406\u6d41\u7a0b\u7684\u7b80\u8981\u4ecb\u7ecd\uff0c\u6211\u4eec\u4e86\u89e3\u4e86Model\u548cView\u5c42\u5404\u81ea\u7684\u529f\u80fd\u4e0e\u5de5\u4f5c\u673a\u5236\uff0c\u5e76\u660e\u767d\u4e86\u5b83\u4eec\u5982\u4f55\u534f\u540c\u5de5\u4f5c\u4ee5\u5b9e\u73b0\u6570\u636e\u5904\u7406\u4e0e\u5c55\u793a\u7684\u6d41\u7a0b\u3002<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"

\u672c\u6587\u5c06\u4ecb\u7ecdMVC\u5904\u7406\u6d41\u7a0b\uff0c\u5e76\u6df1\u5165\u63a2\u8ba8\u8be5\u6a21\u5f0f\u5728\u73b0\u4ee3\u8f6f\u4ef6\u5f00\u53d1\u4e2d\u7684\u91cd\u8981\u6027\u4e0e\u5e94\u7528\u3002Model\u5c42\u7684\u6570\u636e\u5904\u7406\u5728MVC\u6a21\u5f0f\u4e2d\uff0cModel\u5c42\u8d1f\u8d23\u6570\u636e\u5904\u7406\u548c\u5b58\u50a8\u3002\u8fd9\u4e00\u90e8\u5206\u5c06\u4f1a\u4ecb\u7ecdM<\/p>\n","protected":false},"author":1,"featured_media":64183,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"categories":[36],"tags":[305],"class_list":["post-76162","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-dzjs"],"_links":{"self":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/76162","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/comments?post=76162"}],"version-history":[{"count":0,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/76162\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media\/64183"}],"wp:attachment":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media?parent=76162"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/categories?post=76162"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/tags?post=76162"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}