{"id":174,"date":"2020-01-17T01:57:01","date_gmt":"2020-01-16T17:57:01","guid":{"rendered":"http:\/\/blog.73007300.xyz\/?p=174"},"modified":"2020-01-17T04:05:11","modified_gmt":"2020-01-16T20:05:11","slug":"thinkphp6-0%e4%bb%bb%e6%84%8f%e6%96%87%e4%bb%b6%e5%88%9b%e5%bb%ba","status":"publish","type":"post","link":"https:\/\/blog.73007300.xyz\/?p=174","title":{"rendered":"ThinkPHP6.0\u4efb\u610f\u6587\u4ef6\u521b\u5efa"},"content":{"rendered":"\n<p>\u5b89\u88c5php 7.1<br> \u5b89\u88c5Composer<br> https:\/\/getcomposer.org\/Composer-Setup.exe <br> \u5207\u6362\u5230\u4f60\u7684WEB\u6839\u76ee\u5f55\u4e0b\u9762\u5e76\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>PS C:\\xampp\\htdocs> composer create-project topthink\/think tp60<\/code><\/pre>\n\n\n\n<p>\u786e\u4fddtp60\/composer.json\u4e2d\u7248\u672c\u662f6.0<br>\n\u5f00\u542fSession(\u6709\u4e9bAPI\u5e94\u7528\u4e0d\u9700\u8981Session,\u9ed8\u8ba4\u5173\u95ed)\uff0c\u7f16\u8f91 tp60\/app\/middleware.php \u53d6\u6d88 \"<br>\n\\think\\middleware\\SessionInit::class<br>\n\"\u7684\u6ce8\u91ca\u3002<br>\n\u53bbgithub\u4e0b\u8f7d6.0\u7684\u6e90\u7801\uff0c\u5c06\u538b\u7f29\u5305\u4e2d\u7684framework-6.0.0\\src\uff0c\u89e3\u538b\u5230 tp\\vendor\\topthink\\framework\\src<br>\n\u542f\u52a8\u5e94\u7528\uff1a<\/p>\n\n\n\n<p>PS C:\\xampp\\htdocs&gt; cd .\\tp60\\<br> PS C:\\xampp\\htdocs\\tp60&gt; php think run --host=0.0.0.0 --port=8080<\/p>\n\n\n\n<p>\u8bbf\u95ee8080\u7aef\u53e3\u786e\u8ba4\u53ef\u4ee5\u8bbf\u95ee\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u6839\u636e\u7f51\u53cb\u4eec\u7684\u5206\u6790\u548c\u5b98\u65b9\u6587\u6863\uff0c\u9700\u8981\u5728\u81ea\u5df1\u7684\u5e94\u7528\u4e2d\u8c03\u7528session\u51fd\u6570\u624d\u4f1a\u89e6\u53d1session\u7684\u4fdd\u5b58\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"587\" height=\"346\" src=\"https:\/\/blog.73007300.xyz\/wp-content\/uploads\/2020\/01\/image-32.png\" alt=\"\" class=\"wp-image-175\"\/><\/figure>\n\n\n\n<p>\u8fd9\u91cc\u5047\u5982\u8fd9\u4e2a\u5e94\u7528\u662f\u8981\u64cd\u4f5cSession\u7684\u3002<br> \u4e8e\u662f\u4fee\u6539app\u76ee\u5f55\u4e0b\u81ea\u5e26\u7684\u5e94\u7528\uff0c\u4fee\u6539app\/controller\/index.php<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\nnamespace app\\controller;\n\nuse app\\BaseController;\n\nclass Index extends BaseController\n{\n    public function index()\n    {\n        session('demo', $_GET['c']);\n        \/\/return '&lt;style type=\"text\/css\">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: \"Century Gothic\",\"Microsoft yahei\"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }&lt;\/style>&lt;div style=\"padding: 24px 48px;\"> &lt;h1>:) &lt;\/h1>&lt;p> ThinkPHP V6&lt;br\/>&lt;span style=\"font-size:30px\">13\u8f7d\u521d\u5fc3\u4e0d\u6539 - \u4f60\u503c\u5f97\u4fe1\u8d56\u7684PHP\u6846\u67b6&lt;\/span>&lt;\/p>&lt;\/div>&lt;script type=\"text\/javascript\" src=\"https:\/\/tajs.qq.com\/stats?sId=64890268\" charset=\"UTF-8\">&lt;\/script>&lt;script type=\"text\/javascript\" src=\"https:\/\/e.topthink.com\/Public\/static\/client.js\">&lt;\/script>&lt;think id=\"eab4b9f840753f8e7\">&lt;\/think>';\n        return 'ThinkPHP V6.0.0';\n    }\n\n    public function hello($name = 'ThinkPHP6')\n    {\n        return 'hello,' . $name;\n    }\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>\u8fd9\u91cc\u7684 $_GET&#91;'c'] \u4f1a\u4f5c\u4e3a $data \u53c2\u6570\u5199\u5165\u4ee5sessionid\u4e3a\u540d\u7684\u6587\u4ef6\u91cc\uff1a<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"434\" height=\"422\" src=\"https:\/\/blog.73007300.xyz\/wp-content\/uploads\/2020\/01\/image-33.png\" alt=\"\" class=\"wp-image-176\"\/><\/figure>\n\n\n\n<p>\u7531\u4e8e\u662fdata\u662f\u7528\u6237\u8f93\u5165\uff0c\u56e0\u6b64\u53ef\u4ee5\u7528\u6765\u5199shell.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1158\" height=\"308\" src=\"https:\/\/blog.73007300.xyz\/wp-content\/uploads\/2020\/01\/image-34.png\" alt=\"\" class=\"wp-image-177\"\/><\/figure>\n\n\n\n<p>\u5199\u5165\u6587\u4ef6\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"441\" height=\"154\" src=\"https:\/\/blog.73007300.xyz\/wp-content\/uploads\/2020\/01\/image-35.png\" alt=\"\" class=\"wp-image-178\"\/><\/figure>\n\n\n\n<p>\u4fee\u6539PHPSESSION,\u53ef\u4ee5\u505a\u5230\u628a\u78c1\u76d8\u5199\u7206\u3002<br>\n\u81f3\u4e8e\u600e\u4e48\u628awebshell\u5199\u5230public\u76ee\u5f55\u4e0b\u8ba9\u6211\u53ef\u4ee5\u8bbf\u95ee\u5230\uff0c\u8fd8\u6ca1\u60f3\u597d\u3002<\/p>\n\n\n\n<p>\u5f71\u54cd\u7248\u672c\uff1a<br> 6.0 <br> 6.1<br> \u53c2\u8003\uff1a<br> <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/mochazz.github.io\/2020\/01\/14\/ThinkPHP6.0%E4%BB%BB%E6%84%8F%E6%96%87%E4%BB%B6%E5%86%99\/?utm_source=tuicool&amp;utm_medium=referral#%E6%BC%8F%E6%B4%9E%E5%88%86%E6%9E%90\" target=\"_blank\">https:\/\/mochazz.github.io\/2020\/01\/14\/ThinkPHP6.0%E4%BB%BB%E6%84%8F%E6%96%87%E4%BB%B6%E5%86%99\/?utm_source=tuicool&amp;utm_medium=referral#%E6%BC%8F%E6%B4%9E%E5%88%86%E6%9E%90<\/a>  <br> <a href=\"https:\/\/www.kancloud.cn\/manual\/thinkphp6_0\/1037635\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">https:\/\/www.kancloud.cn\/manual\/thinkphp6_0\/1037635<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b89\u88c5php 7.1 \u5b89\u88c5Composer https:\/\/getcomposer.org\/Composer-Setup.exe \u5207\u6362\u5230\u4f60\u7684WEB\u6839\u76ee\u5f55\u4e0b\u9762\u5e76\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\uff1a \u786e\u4fddtp60\/composer.json\u4e2d\u7248\u672c\u662f6.0 \u5f00\u542fSession(\u6709\u4e9bAPI\u5e94\u7528\u4e0d\u9700\u8981Session,\u9ed8\u8ba4\u5173\u95ed)\uff0c\u7f16\u8f91 tp60\/app\/middleware.php \u53d6\u6d88 &#8221; \\think\\middleware\\SessionInit::class &#8220;\u7684\u6ce8\u91ca\u3002 \u53bbgithub\u4e0b\u8f7d6.0\u7684\u6e90\u7801\uff0c\u5c06\u538b\u7f29\u5305\u4e2d\u7684framework-6.0.0\\src\uff0c\u89e3\u538b\u5230 tp\\vendor\\topthink\\framework\\src \u542f\u52a8\u5e94\u7528\uff1a PS C:\\xampp\\htdocs&gt; cd .\\tp60\\ PS C:\\xampp\\htdocs\\tp60&gt; php think run &#8211;host=0.0.0.0 &#8211;port=8080 \u8bbf\u95ee8080\u7aef\u53e3\u786e\u8ba4\u53ef\u4ee5\u8bbf\u95ee\u3002 \u6839\u636e\u7f51\u53cb\u4eec\u7684\u5206\u6790\u548c\u5b98\u65b9\u6587\u6863\uff0c\u9700\u8981\u5728\u81ea\u5df1\u7684\u5e94\u7528\u4e2d\u8c03\u7528session\u51fd\u6570\u624d\u4f1a\u89e6\u53d1session\u7684\u4fdd\u5b58\u3002 \u8fd9\u91cc\u5047\u5982\u8fd9\u4e2a\u5e94\u7528\u662f\u8981\u64cd\u4f5cSession\u7684\u3002 \u4e8e\u662f\u4fee\u6539app\u76ee\u5f55\u4e0b\u81ea\u5e26\u7684\u5e94\u7528\uff0c\u4fee\u6539app\/controller\/index.php \u7531\u4e8e\u662fdata\u662f\u7528\u6237\u8f93\u5165\uff0c\u56e0\u6b64\u53ef\u4ee5\u7528\u6765\u5199shell. \u5199\u5165\u6587\u4ef6\uff1a \u4fee\u6539PHPSESSION,\u53ef\u4ee5\u505a\u5230\u628a\u78c1\u76d8\u5199\u7206\u3002 \u81f3\u4e8e\u600e\u4e48\u628awebshell\u5199\u5230public\u76ee\u5f55\u4e0b\u8ba9\u6211\u53ef\u4ee5\u8bbf\u95ee\u5230\uff0c\u8fd8\u6ca1\u60f3\u597d\u3002 \u5f71\u54cd\u7248\u672c\uff1a 6.0 6.1 \u53c2\u8003\uff1a https:\/\/mochazz.github.io\/2020\/01\/14\/ThinkPHP6.0%E4%BB%BB%E6%84%8F%E6%96%87%E4%BB%B6%E5%86%99\/?utm_source=tuicool&amp;utm_medium=referral#%E6%BC%8F%E6%B4%9E%E5%88%86%E6%9E%90 https:\/\/www.kancloud.cn\/manual\/thinkphp6_0\/1037635<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,2],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.73007300.xyz\/index.php?rest_route=\/wp\/v2\/posts\/174"}],"collection":[{"href":"https:\/\/blog.73007300.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.73007300.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.73007300.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.73007300.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=174"}],"version-history":[{"count":2,"href":"https:\/\/blog.73007300.xyz\/index.php?rest_route=\/wp\/v2\/posts\/174\/revisions"}],"predecessor-version":[{"id":180,"href":"https:\/\/blog.73007300.xyz\/index.php?rest_route=\/wp\/v2\/posts\/174\/revisions\/180"}],"wp:attachment":[{"href":"https:\/\/blog.73007300.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.73007300.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.73007300.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}