{"id":74326,"date":"2024-01-06T01:26:29","date_gmt":"2024-01-05T17:26:29","guid":{"rendered":"https:\/\/www.techphant.cn\/?p=74326"},"modified":"2024-01-06T01:26:29","modified_gmt":"2024-01-05T17:26:29","slug":"wsmltjlcmlqmyjz","status":"publish","type":"post","link":"https:\/\/www.techphant.cn\/blog\/74326.html","title":{"rendered":"\u4e3a\u4ec0\u4e48laravel\u6dfb\u52a0\u4e86console\u547d\u4ee4\u5374\u6ca1\u6709\u52a0\u8f7d"},"content":{"rendered":"

  \u901a\u8fc7\u8fd9\u7bc7\u6587\u7ae0\uff0c\u4f60\u5c06\u4e86\u89e3\u5230\u4e3a\u4ec0\u4e48laravel\u6dfb\u52a0\u4e86console\u547d\u4ee4\u5374\u6ca1\u6709\u52a0\u8f7d\uff0c\u4ee5\u53ca\u5982\u4f55\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n

Laravel\u4e2dConsole\u547d\u4ee4\u7684\u52a0\u8f7d\u673a\u5236<\/h2>\n

  Console\u547d\u4ee4\u7684\u4f5c\u7528<\/h3>\n

  Console\u547d\u4ee4\u5728Laravel\u4e2d\u626e\u6f14\u7740\u81f3\u5173\u91cd\u8981\u7684\u89d2\u8272\uff0c\u5b83\u4eec\u53ef\u4ee5\u7528\u4e8e\u5f00\u53d1\u8005\u5728\u547d\u4ee4\u884c\u4e2d\u6267\u884c\u5404\u79cd\u4efb\u52a1\uff0c\u4f8b\u5982\u6570\u636e\u5e93\u8fc1\u79fb\u3001\u4efb\u52a1\u8c03\u5ea6\u7b49\u3002<\/p>\n

  \u4e3a\u4ec0\u4e48Console\u547d\u4ee4\u6ca1\u52a0\u8f7d<\/h3>\n

  \u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u6709\u65f6\u5019\u6211\u4eec\u5728Laravel\u4e2d\u6dfb\u52a0\u4e86\u65b0\u7684Console\u547d\u4ee4\uff0c\u4f46\u5374\u53d1\u73b0\u5b83\u4eec\u5e76\u6ca1\u6709\u88ab\u6210\u529f\u52a0\u8f7d\uff0c\u8fd9\u53ef\u80fd\u662f\u7531\u4e8e\u4e0d\u6070\u5f53\u7684\u6ce8\u518c\u65b9\u5f0f\u3001\u547d\u540d\u89c4\u8303\u95ee\u9898\u6216\u8005Composer\u81ea\u52a8\u52a0\u8f7d\u673a\u5236\u7b49\u591a\u79cd\u539f\u56e0\u9020\u6210\u7684\u3002<\/p>\n

  \u6ce8\u518c\u65b9\u5f0f\u4e0d\u5f53<\/h4>\n

  \u5728Laravel\u4e2d\uff0c\u9700\u8981\u5728app\/Console\/Kernel.php<\/code>\u6587\u4ef6\u4e2d\u6ce8\u518cConsole\u547d\u4ee4\uff0c\u82e5\u6ce8\u518c\u65b9\u5f0f\u4e0d\u5f53\u5219\u4f1a\u5bfc\u81f4\u547d\u4ee4\u65e0\u6cd5\u88ab\u6b63\u786e\u52a0\u8f7d\u3002<\/p>\n

  \u547d\u540d\u89c4\u8303\u95ee\u9898<\/h4>\n

  Console\u547d\u4ee4\u7c7b\u7684\u547d\u540d\u548c\u4f4d\u7f6e\u4e5f\u662f\u4e00\u4e2a\u5e38\u89c1\u95ee\u9898\uff0c\u5982\u679c\u4e0d\u7b26\u5408Laravel\u7684\u547d\u540d\u89c4\u8303\u6216\u8def\u5f84\u9519\u8bef\uff0c\u4e5f\u4f1a\u5bfc\u81f4\u547d\u4ee4\u65e0\u6cd5\u52a0\u8f7d\u3002<\/p>\n

  Composer\u81ea\u52a8\u52a0\u8f7d\u673a\u5236<\/h4>\n

  \u6709\u65f6\u5019\uff0c\u95ee\u9898\u53ef\u80fd\u51fa\u5728Composer\u7684\u81ea\u52a8\u52a0\u8f7d\u673a\u5236\u4e0a\uff0c\u4f8b\u5982\u7f13\u5b58\u672a\u88ab\u6e05\u9664\u3001\u7c7b\u540d\u672a\u88ab\u6b63\u786e\u52a0\u8f7d\u7b49\u3002<\/p>\n

\u89e3\u51b3\u65b9\u6cd5<\/h2>\n

  \u6b63\u786e\u7684\u547d\u4ee4\u6ce8\u518c\u65b9\u5f0f<\/h3>\n

  \u786e\u4fdd\u5728app\/Console\/Kernel.php<\/code>\u6587\u4ef6\u4e2d\u4f7f\u7528\u6b63\u786e\u7684\u547d\u4ee4\u6ce8\u518c\u65b9\u5f0f\uff0c\u786e\u4fdd\u547d\u4ee4\u7c7b\u548c\u547d\u4ee4\u884c\u540d\u79f0\u6b63\u786e\u6ce8\u518c\u5230Laravel\u7684\u63a7\u5236\u53f0\u4e2d\u3002<\/p>\n

  \u68c0\u67e5\u547d\u540d\u89c4\u8303\u548c\u7c7b\u4f4d\u7f6e<\/h3>\n

  \u786e\u8ba4Console\u547d\u4ee4\u7c7b\u7684\u547d\u540d\u548c\u4f4d\u7f6e\u7b26\u5408Laravel\u7684\u547d\u540d\u89c4\u8303\uff0c\u5e76\u4f4d\u4e8eapp\/Console\/Commands<\/code>\u76ee\u5f55\u4e0b\u3002<\/p>\n

  \u6e05\u9664Composer\u81ea\u52a8\u52a0\u8f7d\u7f13\u5b58<\/h3>\n

  \u6e05\u9664Composer\u81ea\u52a8\u52a0\u8f7d\u7f13\u5b58\uff0c\u53ef\u4ee5\u901a\u8fc7\u6267\u884ccomposer dump-autoload<\/code>\u547d\u4ee4\u6765\u91cd\u65b0\u751f\u6210Composer\u81ea\u52a8\u52a0\u8f7d\u6587\u4ef6\uff0c\u5e76\u786e\u4fdd\u6240\u6709\u7c7b\u88ab\u6b63\u786e\u52a0\u8f7d\u3002<\/p>\n

\u603b\u7ed3<\/h2>\n

  \u5728Laravel\u4e2d\uff0c\u6dfb\u52a0\u65b0\u7684Console\u547d\u4ee4\u672a\u88ab\u52a0\u8f7d\u7684\u95ee\u9898\u53ef\u80fd\u6765\u6e90\u4e8e\u6ce8\u518c\u65b9\u5f0f\u3001\u547d\u540d\u89c4\u8303\u6216Composer\u81ea\u52a8\u52a0\u8f7d\u673a\u5236\u7b49\u65b9\u9762\u3002<\/strong>\u6709\u6548\u7684\u89e3\u51b3\u65b9\u6cd5\u5305\u62ec\u68c0\u67e5\u6ce8\u518c\u65b9\u5f0f\u3001\u547d\u540d\u89c4\u8303\u548c\u6267\u884cComposer\u81ea\u52a8\u52a0\u8f7d\u7f13\u5b58\u6e05\u9664\u3002\u901a\u8fc7\u6b63\u786e\u638c\u63e1\u8fd9\u4e9b\u77e5\u8bc6\uff0c\u4f60\u53ef\u4ee5\u66f4\u597d\u5730\u89e3\u51b3\u6216\u907f\u514d\u8fd9\u7c7b\u95ee\u9898\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u901a\u8fc7\u8fd9\u7bc7\u6587\u7ae0\uff0c\u4f60\u5c06\u4e86\u89e3\u5230\u4e3a\u4ec0\u4e48laravel\u6dfb\u52a0\u4e86console\u547d\u4ee4\u5374\u6ca1\u6709\u52a0\u8f7d\uff0c\u4ee5\u53ca\u5982\u4f55\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002Laravel\u4e2dConsole\u547d\u4ee4\u7684\u52a0\u8f7d\u673a\u5236Cons<\/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":[52],"class_list":["post-74326","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-wxtx"],"_links":{"self":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/74326","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=74326"}],"version-history":[{"count":0,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/74326\/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=74326"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/categories?post=74326"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/tags?post=74326"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}