{"id":26634,"date":"2024-11-24T15:34:08","date_gmt":"2024-11-24T07:34:08","guid":{"rendered":"https:\/\/fwq.ai\/blog\/26634\/"},"modified":"2024-11-24T15:34:08","modified_gmt":"2024-11-24T07:34:08","slug":"nexaphp-%e7%ae%80%e4%bb%8b%ef%bc%9a%e8%bd%bb%e9%87%8f%e7%ba%a7-mvc-php-%e6%a1%86%e6%9e%b6","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/26634\/","title":{"rendered":"NexaPHP \u7b80\u4ecb\uff1a\u8f7b\u91cf\u7ea7 MVC PHP \u6846\u67b6"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173103293316042.jpg\" class=\"aligncenter\" title=\"NexaPHP \u7b80\u4ecb\uff1a\u8f7b\u91cf\u7ea7 MVC PHP \u6846\u67b6\u63d2\u56fe\" alt=\"NexaPHP \u7b80\u4ecb\uff1a\u8f7b\u91cf\u7ea7 MVC PHP \u6846\u67b6\u63d2\u56fe\" \/><\/p>\n<p>\u6784\u5efa php \u5e94\u7528\u7a0b\u5e8f\u901a\u5e38\u6d89\u53ca\u5927\u91cf\u6837\u677f\u4ee3\u7801\u548c\u7ec4\u7ec7\u4ee5\u4fdd\u6301\u5e72\u51c0\u7684\u7ed3\u6784\u3002\u8bb8\u591a\u5f00\u53d1\u4eba\u5458\u4f7f\u7528  \u6216 symfony \u7b49\u6846\u67b6\u6765\u5904\u7406\u6b64\u95ee\u9898\uff0c\u4f46\u5982\u679c\u60a8\u53ea\u9700\u8981\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u3001\u7b80\u5355\u7684 mvc\uff08\u6a21\u578b-\u89c6\u56fe-\u63a7\u5236\u5668\uff09\u6846\u67b6\u600e\u4e48\u529e\uff1f <strong>nexaphp<\/strong> \u53ef\u80fd\u6b63\u662f\u60a8\u6b63\u5728\u5bfb\u627e\u7684\u3002\u8fd9\u4e2a\u6781\u7b80\u4e3b\u4e49\u6846\u67b6\u662f\u4e3a\u90a3\u4e9b\u60f3\u8981\u7cbe\u76ca\u7ed3\u6784\u800c\u6ca1\u6709\u5927\u578b\u6846\u67b6\u7684\u91cd\u91cf\u7684\u5f00\u53d1\u4eba\u5458\u800c\u8bbe\u8ba1\u7684\uff0c\u4f7f\u5176\u6210\u4e3a\u5b66\u4e60\u6216\u521b\u5efa\u4e2d\u5c0f\u578b\u5e94\u7528\u7a0b\u5e8f\u7684\u7406\u60f3\u9009\u62e9\u3002<\/p>\n<hr>\n<h3> \u4e3a\u4ec0\u4e48\u9009\u62e9 nexaphp\uff1f <\/h3>\n<p>nexaphp \u4e13\u4e3a\u91cd\u89c6\u7b80\u5355\u6027\u5e76\u5e0c\u671b\u5bf9\u6838\u5fc3\u6846\u67b6\u529f\u80fd\u6709\u66f4\u591a\u63a7\u5236\u7684\u5f00\u53d1\u4eba\u5458\u91cf\u8eab\u5b9a\u5236\u3002 nexaphp \u7684\u8bbe\u8ba1\u975e\u5e38\u7b80\u5355\uff0c\u8ba9\u60a8\u53ef\u4ee5\u4e13\u6ce8\u4e8e\u5e94\u7528\u7a0b\u5e8f\u7684\u57fa\u672c\u65b9\u9762\uff0c\u800c\u65e0\u9700\u6d4f\u89c8\u7e41\u91cd\u7684\u6846\u67b6\u62bd\u8c61\u3002\u4ee5\u4e0b\u662f nexaphp \u63d0\u4f9b\u7684\u529f\u80fd\uff1a<\/p>\n<ul>\n<li> <strong>\u8f7b\u91cf\u7ea7\u548c\u6700\u5c0f\u5316<\/strong> &#8211; \u6838\u5fc3mvc\u7ec4\u4ef6\uff0c\u6ca1\u6709\u8fc7\u591a\u7684\u4f9d\u8d56\u3002<\/li>\n<li> <strong>\u8f7b\u677e\u8bbe\u7f6e\u548c\u914d\u7f6e<\/strong> &#8211; \u6570\u636e\u5e93\u548c\u8def\u7531\u7684\u76f4\u63a5\u914d\u7f6e\u3002<\/li>\n<li> <strong>\u4e2d\u95f4\u4ef6\u652f\u6301<\/strong> &#8211; \u6dfb\u52a0\u81ea\u5b9a\u4e49\u4e2d\u95f4\u4ef6\u4ee5\u589e\u5f3a\u8bf7\u6c42\u8fc7\u6ee4\u3002<\/li>\n<li> <strong>\u4e8b\u4ef6\u9a71\u52a8<\/strong> &#8211; \u4f7f\u7528\u81ea\u5b9a\u4e49\u4e8b\u4ef6\u6765\u81ea\u5b9a\u4e49\u5e94\u7528\u7a0b\u5e8f\u884c\u4e3a\u3002<\/li>\n<\/ul>\n<p>\u65e0\u8bba\u60a8\u662f\u60f3\u8981\u5b66\u4e60 mvc \u539f\u7406\u7684\u521d\u5b66\u8005\u8fd8\u662f\u7ecf\u9a8c\u4e30\u5bcc\u7684\u5f00\u53d1\u4eba\u5458\uff0cnexaphp \u5360\u7528\u7a7a\u95f4\u5c0f\uff0c\u90fd\u53ef\u4ee5\u8ba9\u60a8\u76f4\u63a5\u8fdb\u5165 php web \u5f00\u53d1\u3002 <\/p>\n<hr>\n<h3> nexaphp \u5165\u95e8 <\/h3>\n<h4> 1. \u5b89\u88c5 <\/h4>\n<p>\u901a\u8fc7  \u5b89\u88c5 nexaphp\uff0c\u8fd9\u6837\u53ef\u4ee5\u8f7b\u677e\u96c6\u6210\u5230\u4efb\u4f55 php \u9879\u76ee\u4e2d\uff1a<\/p>\n<pre>composer require ravikisha\/nexaphp\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h4> 2. \u57fa\u672c\u8bbe\u7f6e <\/h4>\n<p>\u8981\u521d\u59cb\u5316 nexaphp \u5e94\u7528\u7a0b\u5e8f\uff0c\u8bf7\u914d\u7f6e\u5e94\u7528\u7a0b\u5e8f\u6839\u76ee\u5f55\u548c\u6570\u636e\u5e93\u8be6\u7ec6\u4fe1\u606f\uff1a<\/p>\n<pre>use ravikisha\nexaphppplication;\n\n$config = [\n    'userclass' =&gt; ppmodelsuser::class,\n    'db' =&gt; [\n        'dsn' =&gt; 'mysql:host=localhost;dbname=testdb',\n        'user' =&gt; 'root',\n        'password' =&gt; 'password'\n    ]\n];\n\n$app = new application(__dir__, $config);\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6b64\u8bbe\u7f6e\u5305\u62ec\uff1a<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<ul>\n<li> <strong>userclass<\/strong>\uff1a\u5b9a\u4e49\u7528\u6237\u6a21\u578b\uff0c\u5bf9\u4e8e\u5904\u7406\u7528\u6237\u8eab\u4efd\u9a8c\u8bc1\u548c\u7ba1\u7406\u81f3\u5173\u91cd\u8981\u3002<\/li>\n<li> <strong>db<\/strong>\uff1a\u63d0\u4f9b\u6570\u636e\u5e93\u8fde\u63a5\u53c2\u6570\uff0c\u5305\u62ec\u6570\u636e\u6e90\u540d\u79f0\uff08dsn\uff09\u3001\u7528\u6237\u548c\u5bc6\u7801\u3002<\/li>\n<\/ul>\n<hr>\n<h3> nexaphp \u4e2d\u7684\u5173\u952e\u7ec4\u4ef6 <\/h3>\n<p>nexaphp \u63d0\u4f9b\u4e86\u51e0\u4e2a\u57fa\u7840\u7c7b\u6765\u652f\u6301\u5176\u6838\u5fc3 mvc \u7ed3\u6784\uff1a<\/p>\n<ol>\n<li> <strong>\u5e94\u7528\u7a0b\u5e8f<\/strong>\uff1a\u7ba1\u7406\u5e94\u7528\u7a0b\u5e8f\u7684\u751f\u547d\u5468\u671f\u5e76\u534f\u8c03\u4e0d\u540c\u7684\u7ec4\u4ef6\u3002<\/li>\n<li> <strong>\u8def\u7531\u5668<\/strong>\uff1a\u5c06 url \u6620\u5c04\u5230\u7279\u5b9a\u7684\u63a7\u5236\u5668\u548c\u64cd\u4f5c\u3002<\/li>\n<li> <strong>request<\/strong> \u548c <strong>response<\/strong>\uff1a\u5904\u7406 http \u8bf7\u6c42\u548c\u54cd\u5e94\u3002<\/li>\n<li> <strong>\u6570\u636e\u5e93<\/strong>\uff1a\u7ba1\u7406\u6570\u636e\u5e93\u8fde\u63a5\u548c\u67e5\u8be2\u3002<\/li>\n<li> <strong>session<\/strong>\uff1a\u63d0\u4f9b\u4f1a\u8bdd\u7ba1\u7406\u529f\u80fd\u3002<\/li>\n<li> <strong>view<\/strong>\uff1a\u5904\u7406 html \u6a21\u677f\u7684\u6e32\u67d3\u3002<\/li>\n<\/ol>\n<hr>\n<h3> \u6784\u5efa\u60a8\u7684\u7b2c\u4e00\u4e2a\u63a7\u5236\u5668 <\/h3>\n<p>\u63a7\u5236\u5668\u5b9a\u4e49 nexaphp \u5982\u4f55\u5904\u7406\u4e0d\u540c\u8def\u7531\u7684\u8bf7\u6c42\u3002\u8fd9\u662f sitecontroller \u7684\u793a\u4f8b\uff1a<\/p>\n<pre>namespace appcontrollers;\n\nuse ravikisha\nexaphpcontroller;\n\nclass sitecontroller extends controller\n{\n    public function home()\n    {\n        return $this-&gt;render('home');\n    }\n\n    public function contact()\n    {\n        return $this-&gt;render('contact');\n    }\n}\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f7f\u7528 $this-&gt;render() \u6e32\u67d3\u89c6\u56fe\u6587\u4ef6\uff0c\u800c setlayout() \u53ef\u4ee5\u5b9a\u4e49\u81ea\u5b9a\u4e49\u5e03\u5c40\u3002<\/p>\n<hr>\n<h3> \u5b9a\u4e49\u8def\u7ebf <\/h3>\n<p>\u8def\u7531\u5668\u5141\u8bb8\u60a8\u5b9a\u4e49\u4e0e\u7279\u5b9a\u63a7\u5236\u5668\u64cd\u4f5c\u76f8\u5bf9\u5e94\u7684 get \u548c post \u8def\u7531\uff1a<\/p>\n<pre>$app-&gt;router-&gt;get('\/', [sitecontroller::class, 'home']);\n$app-&gt;router-&gt;post('\/contact', [sitecontroller::class, 'contact']);\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>nexaphp \u652f\u6301\u5e26\u53c2\u6570\u7684\u52a8\u6001\u8def\u7531\uff0c\u5141\u8bb8\u60a8\u5904\u7406\u7279\u5b9a\u4e8e\u7528\u6237\u7684\u9875\u9762\uff1a<\/p>\n<pre>$app-&gt;router-&gt;get('\/profile\/{id}', [usercontroller::class, 'profile']);\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<hr>\n<h3> \u6570\u636e\u5e93\u96c6\u6210 <\/h3>\n<p>nexaphp \u4f7f\u7528 pdo \u8fdb\u884c\u6570\u636e\u5e93\u4ea4\u4e92\uff0c\u53ef\u4ee5\u8f7b\u677e\u4e0e\u5404\u79cd\u6570\u636e\u5e93\u96c6\u6210\u3002\u8fd9\u662f\u4e00\u4e2a\u5feb\u901f\u6982\u8ff0\uff1a<\/p>\n<ol>\n<li>\n<p><strong>\u5b9a\u4e49\u6a21\u578b<\/strong>\uff1a\u4f7f\u7528\u6a21\u578b\u4e0e\u6570\u636e\u5e93\u8868\u4ea4\u4e92\u3002<\/p>\n<pre>namespace appmodels;\n\nuse ravikisha\nexaphpdbdbmodel;\n\nclass user extends dbmodel\n{\n    public string $id;\n    public string $name;\n\n    public static function tablename(): string\n    {\n        return 'users';\n    }\n\n    public function attributes(): array\n    {\n        return ['id', 'name'];\n    }\n}\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p><strong>\u8fc1\u79fb<\/strong>\uff1anexaphp \u53ef\u4ee5\u8fd0\u884c\u8fc1\u79fb\u4ee5\u4fdd\u6301\u6570\u636e\u5e93\u67b6\u6784\u66f4\u65b0\uff1a<\/p>\n<pre>$app-&amp;gt;db-&amp;gt;applymigrations();\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p><strong>crud \u64cd\u4f5c<\/strong>\uff1anexaphp \u63d0\u4f9b\u4e86 save() \u548c findone() \u7b49\u65b9\u6cd5\u6765\u8fdb\u884c\u6570\u636e\u5e93\u64cd\u4f5c\u3002<\/p>\n<\/li>\n<\/ol>\n<hr>\n<h3> \u4e2d\u95f4\u4ef6\u652f\u6301 <\/h3>\n<p>nexaphp \u7684\u4e2d\u95f4\u4ef6\u529f\u80fd\u5141\u8bb8\u60a8\u5b9e\u73b0\u8bf7\u6c42\u8fc7\u6ee4\u548c\u63a7\u5236\u3002\u4ee5\u4e0b\u662f\u521b\u5efa\u548c\u5e94\u7528\u81ea\u5b9a\u4e49\u4e2d\u95f4\u4ef6\u7684\u793a\u4f8b\uff1a<\/p>\n<pre>namespace appmiddlewares;\n\nuse ravikisha\nexaphpmiddlewaresasemiddleware;\n\nclass authmiddleware extends basemiddleware\n{\n    public function execute()\n    {\n        \/\/ authentication logic\n    }\n}\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6ce8\u518c\u4e2d\u95f4\u4ef6\uff1a<\/p>\n<pre>$this-&gt;registermiddleware(new authmiddleware(['profile', 'settings']));\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<hr>\n<h3> \u89c6\u56fe\u548c\u6a21\u677f <\/h3>\n<p>nexaphp \u89c6\u56fe\u63d0\u4f9b\u4e86\u4e00\u79cd\u7ba1\u7406 html \u6a21\u677f\u7684\u7b80\u5355\u65b9\u6cd5\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u6a21\u677f\u5b58\u50a8\u5728views\u6587\u4ef6\u5939\u4e2d\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u5e03\u5c40\u6587\u4ef6\u6765\u4fdd\u6301\u8bbe\u8ba1\u7684\u4e00\u81f4\u6027\u3002<\/p>\n<pre>return $this-&gt;render('profile', ['name' =&gt; 'john doe']);\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u53ef\u4ee5\u5728\u89c6\u56fe\/\u5e03\u5c40\u4e0b\u5b9a\u4e49\u5e03\u5c40\uff0c\u5e76\u4e14\u50cf {{content}} \u8fd9\u6837\u7684\u5360\u4f4d\u7b26\u5141\u8bb8\u52a8\u6001\u63d2\u5165\u89c6\u56fe\u3002<\/p>\n<hr>\n<h3> \u8868\u683c\u548c\u5b57\u6bb5 <\/h3>\n<p>nexaphp \u63d0\u4f9b\u4e86\u65b9\u4fbf\u7684\u8868\u5355\u548c\u5b57\u6bb5\u751f\u6210\u5668\uff0c\u53ef\u4ee5\u8f7b\u677e\u521b\u5efa\u52a8\u6001 html \u8868\u5355\uff1a<\/p>\n<pre>use ravikisha\nexaphpormorm;\n\n$form = form::begin('\/submit', 'post');\necho $form-&gt;field($model, 'username');\nform::end();\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u60a8\u53ef\u4ee5\u5448\u73b0\u5404\u79cd\u5b57\u6bb5\u7c7b\u578b\uff0c\u4f8b\u5982\u5bc6\u7801\u3001\u7535\u5b50\u90ae\u4ef6\u548c\u65e5\u671f\u5b57\u6bb5\uff0c\u4ee5\u6ee1\u8db3\u4e0d\u540c\u7684\u8868\u5355\u8981\u6c42\u3002<\/p>\n<hr>\n<h3> \u4f1a\u8bdd\u7ba1\u7406 <\/h3>\n<p>session \u7c7b\u63d0\u4f9b\u4f1a\u8bdd\u5904\u7406\uff0c\u5141\u8bb8\u60a8\u8bbe\u7f6e\u3001\u83b7\u53d6\u548c\u7ba1\u7406 flash \u6d88\u606f\uff1a<\/p>\n<pre>application::$app-&gt;session-&gt;setflash('success', 'logged in successfully');\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u5bf9\u4e8e\u663e\u793a\u4e34\u65f6\u901a\u77e5\u7279\u522b\u6709\u7528\u3002<\/p>\n<hr>\n<h3> \u5f02\u5e38\u5904\u7406 <\/h3>\n<p>nexaphp \u5185\u7f6e\u4e86\u5bf9\u5904\u7406\u5f02\u5e38\u7684\u652f\u6301\uff0c\u5305\u62ec\uff1a<\/p>\n<ul>\n<li> <strong>notfoundexception<\/strong> \u65e0\u6548\u8def\u7531\u3002<\/li>\n<li> <strong>forbiddenexception<\/strong> \u7528\u4e8e\u8bbf\u95ee\u63a7\u5236\u3002<\/li>\n<\/ul>\n<hr>\n<h3> \u7528\u6237\u8ba4\u8bc1 <\/h3>\n<p>\u7528\u6237\u8eab\u4efd\u9a8c\u8bc1\u901a\u8fc7\u62bd\u8c61 usermodel \u7c7b\u8fdb\u884c\u7ba1\u7406\uff0c\u8be5\u7c7b\u63d0\u4f9b\u4e86\u8bf8\u5982 login()\u3001logout() \u548c isguest() \u7b49\u57fa\u672c\u65b9\u6cd5\u3002<\/p>\n<pre>class user extends usermodel\n{\n    public static function primarykey(): string\n    {\n        return 'id';\n    }\n\n    public function getdisplayname(): string\n    {\n        return $this-&gt;username;\n    }\n}\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<hr>\n<h3> nexaphp \u5e94\u7528\u7a0b\u5e8f\u793a\u4f8b <\/h3>\n<p>\u4e0b\u9762\u662f\u57fa\u672c nexaphp \u5e94\u7528\u7a0b\u5e8f\u8bbe\u7f6e\u7684\u793a\u4f8b\uff1a<\/p>\n<pre>require_once __DIR__ . '\/vendor\/autoload.php';\n\nuse ravikisha\nexaphpApplication;\nuse appcontrollersSiteController;\n\n$config = [\n    'userClass' =&gt; ppmodelsUser::class,\n    'db' =&gt; [\n        'dsn' =&gt; 'mysql:host=localhost;dbname=testdb',\n        'user' =&gt; 'root',\n        'password' =&gt; 'password'\n    ]\n];\n\n$app = new Application(__DIR__, $config);\n\n$app-&gt;router-&gt;get('\/', [SiteController::class, 'home']);\n$app-&gt;router-&gt;get('\/contact', [SiteController::class, 'contact']);\n\n$app-&gt;run();\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<hr>\n<h3> \u7ed3\u8bba <\/h3>\n<p>nexaphp \u63d0\u4f9b\u4e86\u4e00\u79cd\u4f7f\u7528 php \u6784\u5efa mvc \u5e94\u7528\u7a0b\u5e8f\u7684\u5e72\u51c0\u7b80\u6d01\u7684\u65b9\u6cd5\u3002\u867d\u7136\u5b83\u9002\u7528\u4e8e\u5b66\u4e60\u548c\u5c0f\u578b\u9879\u76ee\uff0c\u4f46\u5bf9\u4e8e\u90a3\u4e9b\u60f3\u8981\u4e86\u89e3 mvc \u6846\u67b6\u5982\u4f55\u5728\u5e55\u540e\u5de5\u4f5c\u7684\u4eba\u6765\u8bf4\uff0c\u5b83\u662f\u4e00\u4e2a\u4e0d\u9519\u7684\u9009\u62e9\u3002\u5728 hub \u4e0a\u63a2\u7d22\u8be5\u6846\u67b6\u6216\u901a\u8fc7 composer \u5b89\u88c5\u5b83\u6765\u5f00\u59cb\u4f7f\u7528\u3002<\/p>\n<p><strong>github\uff1a<\/strong> nexaphp github<\/p>\n<p><strong>\u4f5c\u66f2\u5bb6\uff1a<\/strong>packagist \u4e0a\u7684 nexaphp<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fNexaPHP \u7b80\u4ecb\uff1a\u8f7b\u91cf\u7ea7 MVC PHP \u6846\u67b6\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6784\u5efa php \u5e94\u7528\u7a0b\u5e8f\u901a\u5e38\u6d89\u53ca\u5927\u91cf\u6837\u677f\u4ee3\u7801\u548c\u7ec4\u7ec7\u4ee5\u4fdd\u6301\u5e72\u51c0\u7684\u7ed3\u6784\u3002\u8bb8\u591a\u5f00\u53d1\u4eba\u5458\u4f7f\u7528 \u6216 symfony \u7b49\u6846\u67b6\u6765\u5904\u7406\u6b64\u95ee\u9898\uff0c\u4f46\u5982\u679c\u60a8\u53ea\u9700\u8981\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u3001\u7b80\u5355\u7684 mvc\uff08\u6a21\u578b-\u89c6\u56fe-\u63a7\u5236\u5668\uff09\u6846\u67b6\u600e\u4e48\u529e\uff1f nexaphp \u53ef\u80fd\u6b63\u662f\u60a8\u6b63\u5728\u5bfb\u627e\u7684\u3002\u8fd9\u4e2a\u6781\u7b80\u4e3b\u4e49\u6846\u67b6\u662f\u4e3a\u90a3\u4e9b\u60f3\u8981\u7cbe\u76ca\u7ed3\u6784\u800c\u6ca1\u6709\u5927\u578b\u6846\u67b6\u7684\u91cd\u91cf\u7684\u5f00\u53d1\u4eba\u5458\u800c\u8bbe\u8ba1\u7684\uff0c\u4f7f\u5176\u6210\u4e3a\u5b66\u4e60\u6216\u521b\u5efa\u4e2d\u5c0f\u578b\u5e94\u7528\u7a0b\u5e8f\u7684\u7406\u60f3\u9009\u62e9\u3002 \u4e3a\u4ec0\u4e48\u9009\u62e9 nexaphp\uff1f nexaphp \u4e13\u4e3a\u91cd\u89c6\u7b80\u5355\u6027\u5e76\u5e0c\u671b\u5bf9\u6838\u5fc3\u6846\u67b6\u529f\u80fd\u6709\u66f4\u591a\u63a7\u5236\u7684\u5f00\u53d1\u4eba\u5458\u91cf\u8eab\u5b9a\u5236\u3002 nexaphp \u7684\u8bbe\u8ba1\u975e\u5e38\u7b80\u5355\uff0c\u8ba9\u60a8\u53ef\u4ee5\u4e13\u6ce8\u4e8e\u5e94\u7528\u7a0b\u5e8f\u7684\u57fa\u672c\u65b9\u9762\uff0c\u800c\u65e0\u9700\u6d4f\u89c8\u7e41\u91cd\u7684\u6846\u67b6\u62bd\u8c61\u3002\u4ee5\u4e0b\u662f nexaphp \u63d0\u4f9b\u7684\u529f\u80fd\uff1a \u8f7b\u91cf\u7ea7\u548c\u6700\u5c0f\u5316 &#8211; \u6838\u5fc3mvc\u7ec4\u4ef6\uff0c\u6ca1\u6709\u8fc7\u591a\u7684\u4f9d\u8d56\u3002 \u8f7b\u677e\u8bbe\u7f6e\u548c\u914d\u7f6e &#8211; \u6570\u636e\u5e93\u548c\u8def\u7531\u7684\u76f4\u63a5\u914d\u7f6e\u3002 \u4e2d\u95f4\u4ef6\u652f\u6301 &#8211; \u6dfb\u52a0\u81ea\u5b9a\u4e49\u4e2d\u95f4\u4ef6\u4ee5\u589e\u5f3a\u8bf7\u6c42\u8fc7\u6ee4\u3002 \u4e8b\u4ef6\u9a71\u52a8 &#8211; \u4f7f\u7528\u81ea\u5b9a\u4e49\u4e8b\u4ef6\u6765\u81ea\u5b9a\u4e49\u5e94\u7528\u7a0b\u5e8f\u884c\u4e3a\u3002 \u65e0\u8bba\u60a8\u662f\u60f3\u8981\u5b66\u4e60 mvc \u539f\u7406\u7684\u521d\u5b66\u8005\u8fd8\u662f\u7ecf\u9a8c\u4e30\u5bcc\u7684\u5f00\u53d1\u4eba\u5458\uff0cnexaphp \u5360\u7528\u7a7a\u95f4\u5c0f\uff0c\u90fd\u53ef\u4ee5\u8ba9\u60a8\u76f4\u63a5\u8fdb\u5165 php web \u5f00\u53d1\u3002 nexaphp \u5165\u95e8 1. \u5b89\u88c5 \u901a\u8fc7 \u5b89\u88c5 nexaphp\uff0c\u8fd9\u6837\u53ef\u4ee5\u8f7b\u677e\u96c6\u6210\u5230\u4efb\u4f55 php \u9879\u76ee\u4e2d\uff1a composer require ravikisha\/nexaphp \u767b\u5f55\u540e\u590d\u5236 2. \u57fa\u672c\u8bbe\u7f6e \u8981\u521d\u59cb\u5316 nexaphp \u5e94\u7528\u7a0b\u5e8f\uff0c\u8bf7\u914d\u7f6e\u5e94\u7528\u7a0b\u5e8f\u6839\u76ee\u5f55\u548c\u6570\u636e\u5e93\u8be6\u7ec6\u4fe1\u606f\uff1a use [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-26634","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/26634","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=26634"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/26634\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=26634"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=26634"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=26634"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}