php框架代码审计思路
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/515fa79dc4384857ae33a9f3e4de2244~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1729839292&x-signature=F1I7BZPThhIRp4amYgB55kKO4YQ%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">程序员写在<span style="color: black;">文案</span>前:</strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">本周技术分享,程序员小星想以“php框架代码审计”为题,与<span style="color: black;">大众</span>分享一下小星对代码的审计思路。但<span style="color: black;">因为</span>内容较多,此次小星先从兼容模式和path_info模式、命名空间、tp5的正常调用流程等七大部分与<span style="color: black;">大众</span>进行讨论。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;">(一)内容</span></strong></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">1. MVC基本的架构</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">2. 漏洞挖掘</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">thinkphp、Yii、larevel</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">M 模块</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">V 界面</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">C <span style="color: black;">掌控</span>器</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">MVC设计模式的优点?</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">1)解耦合 2)多接口、降低<span style="color: black;">研发</span>成本 3)高复用</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;">(二)<span style="color: black;">运用</span>方式</span></strong></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">application 应用目录(放自己的代码)</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"> |---- admin 放后台文件</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"> |________controller</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"> |---- index 放前台文件</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">|________controller</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">public 入口文件</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"> |---- index.php 网站的入口文件</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">thinkphp 核心文件</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;">(三)<span style="color: black;">拜访</span>方式</span></strong></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">thinkphp所有的都是用URL来实现。</span></strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">thinkphp的<span style="color: black;">拜访</span>模式:</span></strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">1)<span style="color: black;"><span style="color: black;">http://localhost/index.php/模块名<span style="color: black;">叫作</span>/<span style="color: black;">掌控</span>器的名/<span style="color: black;">办法</span>名/参数/vaulue</span></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">2)<span style="color: black;"><span style="color: black;">http://localhost/index.php/模块名<span style="color: black;">叫作</span>/<span style="color: black;">掌控</span>器的名/<span style="color: black;">办法</span>名?参数=value</span></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">模块名<span style="color: black;">叫作</span>:</span></strong><span style="color: black;">在application下,例如index文件夹是模块名。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;"><span style="color: black;">掌控</span>器的名:</span></strong><span style="color: black;">在index下有一controller,这个controller下有index.php,那他的<span style="color: black;">掌控</span>器的名<span style="color: black;">便是</span>index。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;"><span style="color: black;">办法</span>名:</span></strong><span style="color: black;"><span style="color: black;">办法</span><span style="color: black;">便是</span>index.php下的<span style="color: black;">有些</span><span style="color: black;">办法</span>名<span style="color: black;">叫作</span>。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">构造URL:</strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">http://localhost/index.php/index/Index/hello/name/11111</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/d112596e44034eb1b8bffe14eae44a54~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1729839292&x-signature=dlaERToj1sJ3nPQOr6qYtIxKDHo%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;">(四)兼容模式和path_info模式</span></strong></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">1)tp<span style="color: black;">运用</span>兼容模式的写法:</span></strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">http://localhost/index.php?s=index/Index/hello&name=1111</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">2)pathinfo<span style="color: black;">拜访</span>的模式:</span></strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">http://localhost/index.php/index/Index/hello/name/11111</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">3)<span style="color: black;">能够</span>得到:</span></strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">http://localhost/index.php?s=模块/<span style="color: black;">掌控</span>器/<span style="color: black;">办法</span>&参数=value</span></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;">(五)关于命名空间</span></strong></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">tp5遵循一个psr-4自动加载规范,他<span style="color: black;">能够</span>去自动加载类,需要<span style="color: black;">恰当</span>的、正确的命名空间。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">一组的健康的、合格的tp5代码需要一个<span style="color: black;">恰当</span>的命名空间。</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/37ad5efbe71e4f9c996947b2814a37b1~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1729839292&x-signature=d94i%2FfZYSrzU%2BLjco4rmE44WzuA%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">创建一个核心包下的文件kk.php。</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/fcdebd321195451894bfdd51125dd83a~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1729839292&x-signature=mVSYijV1%2BeD4Mqjo%2Fo%2FcZc5lb7I%3D" style="width: 50%; margin-bottom: 20px;"></div>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/6bf5a0d897084183b1f87cde61914d74~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1729839292&x-signature=yTzKAKvOJUFDOrZlFcExEgR7RXc%3D" style="width: 50%; margin-bottom: 20px;"></div>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/5ff73a424e8a4cd8920da8a51b193834~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1729839292&x-signature=XiVfINSfSYdPEIpZ9j5jc03MzYI%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;">得到一个关于命名空间的结论:</span></strong></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">1)<span style="color: black;">倘若</span>你写在application下,那你命名空间的一个根路径是app;</span></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">2)<span style="color: black;">倘若</span>thinkphp下的think,那你命名空间的一个根路径就think;</span></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">3)<span style="color: black;">倘若</span>thinkphp下的traits,那你命名空间的一个根路径<span style="color: black;">便是</span>traits。</span></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;">(六)问题根源</span></strong></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">TP处理URL的一个特性,他<span style="color: black;">运用</span>全局变量。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">http://localhost/index.php/index/\Index/hello/name/11111</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">http://localhost/index.php/index//Index/hello/name/11111</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;">(七)tp5的正常调用流程</span></strong></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;">1. </strong></span><strong style="color: blue;"><span style="color: black;"><span style="color: black;">URL路由解析动态调试分析</span></span></strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">1)先看他这个入口文件的调用<span style="color: black;">亦</span><span style="color: black;">便是</span>public/index.php,<span style="color: black;">按照</span>他的入口文件去找相应的代码。</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/ff730272f71749f79851fcd1103edc3d~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1729839292&x-signature=MwBfE0sD8N0QvftmbPL1BGPR57Y%3D" style="width: 50%; margin-bottom: 20px;"></div>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/16d8ae236118451a9bf8af20c677e1a9~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1729839292&x-signature=HRzsYW97ZSyjMDPGpe4M5dKjWWE%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">2)正式进入路由检测的一个<span style="color: black;">办法</span>。</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/fe9faa76bfcb4df0a34e9de9344a29f1~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1729839292&x-signature=GEvP%2BeIVg7jVHsM56p6ZW1hM2r4%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">3)他会从下图中进一个path<span style="color: black;">办法</span>。</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/6de33b0a6f9541569f481d5bec131023~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1729839292&x-signature=AYQrOFKLa9cg%2FXXCUlhRVk1HzR4%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">4)他会从下图中进一个pathinfo<span style="color: black;">办法</span>。</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/c2653c99f1e24a0594b78c3d2b7903d8~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1729839292&x-signature=XdJYBIWvn2FLYXBBOVRZr7ZJOYM%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">5)要从<span style="color: black;">这儿</span>进入一个server。</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/9f0fe87aeef14b49953468bd8de24d27~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1729839292&x-signature=qFgXDzBEfN%2FMWAbODySBJ%2Fme3jI%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">6)ltrim()<span style="color: black;">办法</span><span style="color: black;">能够</span>把/index/Index/hello//name/11111这一段字符串的最左边的/index/Index/hello//name/11111,以上<span style="color: black;">便是</span>路径解析的一个过程。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;"><span style="color: black;">2.路由解析动态调试</span></span></strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">1)接下来会调用check<span style="color: black;">办法</span>。</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/ffeb7c4d63a8429faeb9dfc30ef147a5~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1729839292&x-signature=PaEgmYc8Q8jv0HTt0J01cBiCm0k%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">2)</span><span style="color: black;">继续跟进check<span style="color: black;">办法</span>。</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/d76ccb6c7b804ac7b09970aff2a646a2~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1729839292&x-signature=6XLc6cgrlFJ4exB7SsNlB5vrSqI%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">3)</span><span style="color: black;">后续他会用str_replace()<span style="color: black;">办法</span>来把斜杠修改成|,调用"use think\route\dispatch\Url as UrlDispatch; " 这个Url.php。</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/d3a3f99f135a4bdc968ad9d9cffefa5d~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1729839292&x-signature=1R%2FC4TGOh%2B%2BcizotJUoAffZ4FJY%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">4)</span><span style="color: black;">跟进至paresUrl中。</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/6ce9f3cb21c4403b8e0c654d841b17b5~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1729839292&x-signature=1RzrX3JgUzQyt5rQfA7%2FgeWayT4%3D" style="width: 50%; margin-bottom: 20px;"></div>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/b44c688c46394d97b1cf9428c3bff3c7~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1729839292&x-signature=MMZgQQzUIHyGx%2B9Rj1YS92%2B%2B360%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">5)</span><span style="color: black;">array_shift()取出<span style="color: black;">第1</span>个模块名,<span style="color: black;">而后</span>用<span style="color: black;">一样</span>的手法给<span style="color: black;">掌控</span>器取出来并且赋值给$controller,再用<span style="color: black;">一样</span>的手法给$action赋值,</span>最后<span style="color: black;">他会把<span style="color: black;">已然</span>拆分的东西打包存放到这个route<span style="color: black;">其中</span>。</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p26-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/d50a2c05219b41e1ba56b4296317d59e~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1729839292&x-signature=3QcYaHwAYm3THvJXGHzkSnktm3U%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">6)</span><span style="color: black;">后续把这一个route的内容返回到init中的$result中去。</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/dce6cad4b0964bc5a2bb0f930952c845~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1729839292&x-signature=cmHQZNrAyLwApRrXq9a9RgfKQpg%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">7)接下来</span><span style="color: black;">他会去new一个module类,<span style="color: black;">然则</span>这个module中没构造<span style="color: black;">办法</span>,<span style="color: black;">因此</span>他会调用一次父类的无参构造,<span style="color: black;">而后</span>再调用module下的初始化<span style="color: black;">办法</span>init。</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/1533cfc06293487ab73280ac5b9e3c6c~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1729839292&x-signature=%2FNEsdMvmf%2BeRTMzPawDjwc8atAc%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">8)</span><span style="color: black;">在进入这个初始化<span style="color: black;">办法</span>后他会用parent::init();再调用一次父类的初始化<span style="color: black;">办法</span>。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;"><span style="color: black;">3. 开启debug后</span></span></strong></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/b22525c1d6f04750a6a2492ad6f5cba2~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1729839292&x-signature=GQ8YM3i1tU260TMFRyvkw%2BOJc54%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">1)<span style="color: black;">倘若</span>开启了debug,他就会对路由的信息进行记录。</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/89536324d5d5449eb10656a3ae399b1b~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1729839292&x-signature=GOz9BxmA3kLsjebUN6r3iTVIn1c%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">2)<span style="color: black;">这边会把请求的参数和URL<span style="color: black;">位置</span>进行参数合并,这边他会调用一次解析过滤器,<span style="color: black;">然则</span>这个过滤器他什么都没写, <span style="color: black;">因此</span>相当于<span style="color: black;">无</span>任何过滤。</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/db5d2ff42c1548e397eb27c467e525cc~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1729839292&x-signature=fjKEakcm4HQRTrbCtH2cdTAjLWs%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">3)<span style="color: black;"><span style="color: black;">刚才</span>的一部分已先获取了一个字符串</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">/admin/index/hello</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">而后</span>把上面的字符串处理<span style="color: black;">成为了</span>以下的形式</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">admin/index/hello</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">最后他会把去掉/的字符串<span style="color: black;">亦</span><span style="color: black;">便是</span>路径会拆分赋值,如下:</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">$module = admin</span> <span style="color: black;">-->模块</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">$controller = index</span> <span style="color: black;">--><span style="color: black;">掌控</span>器</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">$action = hello --><span style="color: black;">办法</span></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">下期,<span style="color: black;">咱们</span>将就“路由动态测试”、“思路总结”两大部分与<span style="color: black;">大众</span>继续探讨,并附上小星在<span style="color: black;">科研</span>过程中的意外<span style="color: black;">发掘</span>,请<span style="color: black;">大众</span>继续支持!</span></span></p>
页:
[1]