-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.xml
229 lines (217 loc) · 24.4 KB
/
search.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<?xml version="1.0" encoding="utf-8"?>
<search>
<entry>
<title>Hello World</title>
<url>/2024/10/22/hello-world/</url>
<content><![CDATA[<p>Welcome to <a href="https://hexo.io/">Hexo</a>! This is your very first post. Check <a href="https://hexo.io/docs/">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href="https://hexo.io/docs/troubleshooting.html">troubleshooting</a> or you can ask me on <a href="https://github.com/hexojs/hexo/issues">GitHub</a>.</p>
<h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="Create-a-new-post"><a href="#Create-a-new-post" class="headerlink" title="Create a new post"></a>Create a new post</h3><figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">$ hexo new <span class="string">"My New Post"</span></span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/writing.html">Writing</a></p>
<h3 id="Run-server"><a href="#Run-server" class="headerlink" title="Run server"></a>Run server</h3><figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">$ hexo server</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/server.html">Server</a></p>
<h3 id="Generate-static-files"><a href="#Generate-static-files" class="headerlink" title="Generate static files"></a>Generate static files</h3><figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">$ hexo generate</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/generating.html">Generating</a></p>
<h3 id="Deploy-to-remote-sites"><a href="#Deploy-to-remote-sites" class="headerlink" title="Deploy to remote sites"></a>Deploy to remote sites</h3><figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">$ hexo deploy</span><br></pre></td></tr></table></figure>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">$ hexo d -g</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/one-command-deployment.html">Deployment</a></p>
]]></content>
</entry>
<entry>
<title>一种测试微信小程序的抓包方法</title>
<url>/2024/10/22/%E4%B8%80%E7%A7%8D%E6%B5%8B%E8%AF%95%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%9A%84%E6%8A%93%E5%8C%85%E6%96%B9%E6%B3%95/</url>
<content><![CDATA[<h2 id="环境信息"><a href="#环境信息" class="headerlink" title="环境信息"></a>环境信息</h2><ol>
<li>系统Microsoft Windows [版本 10.0.19045.5011]</li>
<li>微信 [版本 3.9.11.25]</li>
<li>proxifier [版本 4.03 x64]</li>
<li>burpsuite[版本 Professional 2024.8.4]</li>
<li>everything</li>
</ol>
<h2 id="测试环境搭建"><a href="#测试环境搭建" class="headerlink" title="测试环境搭建"></a>测试环境搭建</h2><ol>
<li>安装好微信。<a href="https://pc.weixin.qq.com/">微信下载地址</a></li>
<li>安装好proxifier,输入激活码:CLOT5-J3GYK-VGPYE-BDPMN-WKWMU(也可以用注册机自己生成:<a href="https://github.com/y9nhjy/Proxifier-Keygen">注册机下载地址</a>)</li>
<li>安装burpsuite,<a href="https://portswigger.net/burp/releases">burpsuite下载地址</a>,<a href="https://github.com/h3110w0r1d-y/BurpLoaderKeygen">注册机下载地址</a>。安装及破解详细教学地址:<a href="https://www.sqlsec.com/2020/10/winbp.html">burpsuite安装及破解</a></li>
</ol>
<h2 id="配置proxifier"><a href="#配置proxifier" class="headerlink" title="配置proxifier"></a>配置proxifier</h2><ol>
<li>配置代理服务器为burpsuite,进入proxifier,找到如下选项</li>
</ol>
<p><img src="/../images/%E4%B8%80%E7%A7%8D%E6%B5%8B%E8%AF%95%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%9A%84%E6%8A%93%E5%8C%85%E6%96%B9%E6%B3%95/image-20241022155637177.png" alt="image-20241022155637177"></p>
<ol start="2">
<li>点击“add”添加“Proxy Server”</li>
</ol>
<p><img src="/../images/%E4%B8%80%E7%A7%8D%E6%B5%8B%E8%AF%95%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%9A%84%E6%8A%93%E5%8C%85%E6%96%B9%E6%B3%95/image-20241022155940152.png" alt="image-20241022155940152"></p>
<ol start="3">
<li>本文章,默认您的burpsuite开启监听的端口是127.0.0.1:8080,所以添加server配置如下图:</li>
</ol>
<p><img src="/../images/%E4%B8%80%E7%A7%8D%E6%B5%8B%E8%AF%95%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%9A%84%E6%8A%93%E5%8C%85%E6%96%B9%E6%B3%95/image-20241022160216298.png" alt="image-20241022160216298"></p>
<ol start="4">
<li>可以点击下方“Check”按钮,确认代理服务器是否能成功连通。</li>
</ol>
<p><img src="/../images/%E4%B8%80%E7%A7%8D%E6%B5%8B%E8%AF%95%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%9A%84%E6%8A%93%E5%8C%85%E6%96%B9%E6%B3%95/image-20241022160514252.png" alt="image-20241022160514252"></p>
<p>如果连通,则显示绿色“Proxy is ready to work with Proxifier!”,如下图。</p>
<p><strong>注意:默认测试连通访问的是<a href="www.google.com">谷歌</a>,如果您未进行科学上网,可能会测试连通性失败,请在右上角“Test Settings”处,改成<a href="www.baidu.com">百度</a></strong></p>
<p><img src="/../images/%E4%B8%80%E7%A7%8D%E6%B5%8B%E8%AF%95%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%9A%84%E6%8A%93%E5%8C%85%E6%96%B9%E6%B3%95/image-20241022160621456.png" alt="image-20241022160621456"></p>
<p><img src="/../images/%E4%B8%80%E7%A7%8D%E6%B5%8B%E8%AF%95%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%9A%84%E6%8A%93%E5%8C%85%E6%96%B9%E6%B3%95/image-20241022160915957.png" alt="image-20241022160915957"></p>
<ol start="5">
<li>配置代理规则,找到下图选项卡</li>
</ol>
<p><img src="/../images/%E4%B8%80%E7%A7%8D%E6%B5%8B%E8%AF%95%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%9A%84%E6%8A%93%E5%8C%85%E6%96%B9%E6%B3%95/image-20241022161340939.png" alt="image-20241022161340939"></p>
<ol start="6">
<li>点击“Add”添加一条规则,“Applications”选择“wechatappex.exe”,这个程序是windows版微信小程序的exe,如果您不知道这个程序路径在哪里,可以使用everything程序进行全局搜索,<a href="https://www.voidtools.com/zh-cn/">everything下载地址</a>。</li>
</ol>
<p><img src="/../images/%E4%B8%80%E7%A7%8D%E6%B5%8B%E8%AF%95%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%9A%84%E6%8A%93%E5%8C%85%E6%96%B9%E6%B3%95/image-20241022162413616.png" alt="image-20241022162413616"></p>
<p>“Action”选择我们之前创建好的代理服务器“Proxy HTTPS 127.0.0.1”</p>
<p><img src="/../images/%E4%B8%80%E7%A7%8D%E6%B5%8B%E8%AF%95%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%9A%84%E6%8A%93%E5%8C%85%E6%96%B9%E6%B3%95/image-20241022161758371.png" alt="image-20241022161758371"></p>
<p><img src="/../images/%E4%B8%80%E7%A7%8D%E6%B5%8B%E8%AF%95%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%9A%84%E6%8A%93%E5%8C%85%E6%96%B9%E6%B3%95/image-20241022161704234.png" alt="image-20241022161704234"></p>
<h2 id="开始测试"><a href="#开始测试" class="headerlink" title="开始测试"></a>开始测试</h2><ol>
<li><p>打开windows版微信,点开任意小程序,测试抓包情况。</p>
</li>
<li><p>打开burpsuite。切换到“Proxy”选项卡中的“HTTP history”选项卡,可以看到成功抓到小程序数据包。</p>
</li>
</ol>
<p><img src="/../images/%E4%B8%80%E7%A7%8D%E6%B5%8B%E8%AF%95%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%9A%84%E6%8A%93%E5%8C%85%E6%96%B9%E6%B3%95/image-20241022163156601.png" alt="image-20241022163156601"></p>
<h2 id="后记"><a href="#后记" class="headerlink" title="后记"></a>后记</h2><ol>
<li>关于不能抓到https数据包的问题。访问:<a href="http://burp/">burp证书下载地址</a>下载证书,并导入“受信任的根证书颁发机构”,可以用“mmc”控制台管理单元添加,相关细节不再赘述。</li>
<li>关于能否用“Proxifier”抓取安卓模拟器数据包,还在测试。</li>
</ol>
]]></content>
<categories>
<category>渗透测试</category>
</categories>
<tags>
<tag>burp使用</tag>
<tag>小程序抓包</tag>
<tag>proxifier</tag>
</tags>
</entry>
<entry>
<title>linux-screen命令使用详解</title>
<url>/2024/10/23/linux-screen%E5%91%BD%E4%BB%A4%E4%BD%BF%E7%94%A8%E8%AF%A6%E8%A7%A3/</url>
<content><![CDATA[<h1 id="screen命令"><a href="#screen命令" class="headerlink" title="screen命令"></a>screen命令</h1><h2 id="创建一个新的窗口"><a href="#创建一个新的窗口" class="headerlink" title="创建一个新的窗口"></a>创建一个新的窗口</h2><p>screen -S test</p>
<h2 id="列出所有窗口"><a href="#列出所有窗口" class="headerlink" title="列出所有窗口"></a>列出所有窗口</h2><p>screen -ls</p>
<h2 id="重新回到窗口"><a href="#重新回到窗口" class="headerlink" title="重新回到窗口"></a>重新回到窗口</h2><p>screen -r test</p>
<h2 id="清除dead会话"><a href="#清除dead会话" class="headerlink" title="清除dead会话"></a>清除dead会话</h2><p>screen -list会显示该会话为dead状态<br>使用screen -wipe命令清除该会话</p>
<h2 id="远程detach某个session"><a href="#远程detach某个session" class="headerlink" title="远程detach某个session"></a>远程detach某个session</h2><p>screen -d test</p>
<h2 id="参数说明"><a href="#参数说明" class="headerlink" title="参数说明"></a>参数说明</h2><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">screen [-AmRvx -ls -wipe][-d <作业名称>][-h <行数>][-r <作业名称>][-s ][-S <作业名称>]</span><br><span class="line"></span><br><span class="line">-A 将所有的视窗都调整为目前终端机的大小。</span><br><span class="line">-d <作业名称> 将指定的screen作业离线。</span><br><span class="line">-h <行数> 指定视窗的缓冲区行数。</span><br><span class="line">-m 即使目前已在作业中的screen作业,仍强制建立新的screen作业。</span><br><span class="line">-r <作业名称> 恢复离线的screen作业。</span><br><span class="line">-R 先试图恢复离线的作业。若找不到离线的作业,即建立新的screen作业。</span><br><span class="line">-s 指定建立新视窗时,所要执行的shell。</span><br><span class="line">-S <作业名称> 指定screen作业的名称。</span><br><span class="line">-v 显示版本信息。</span><br><span class="line">-x 恢复之前离线的screen作业。</span><br><span class="line">-ls或--list 显示目前所有的screen作业。</span><br><span class="line">-wipe 检查目前所有的screen作业,并删除已经无法使用的screen作业。</span><br></pre></td></tr></table></figure>]]></content>
<categories>
<category>常用命令详解</category>
</categories>
<tags>
<tag>linux</tag>
<tag>screen</tag>
</tags>
</entry>
<entry>
<title>文本去重复小工具</title>
<url>/2024/10/23/%E6%96%87%E6%9C%AC%E5%8E%BB%E9%87%8D%E5%A4%8D%E5%B0%8F%E5%B7%A5%E5%85%B7/</url>
<content><![CDATA[<h2 id="工具地址"><a href="#工具地址" class="headerlink" title="工具地址"></a>工具地址</h2><p><a href="https://h4ckforjob.github.io/rmre.html">文本去重复</a></p>
]]></content>
<categories>
<category>web工具</category>
</categories>
<tags>
<tag>小工具</tag>
<tag>去重复</tag>
</tags>
</entry>
<entry>
<title>hexo-next主题文章浏览次数添加单位</title>
<url>/2024/10/23/hexo-next%E4%B8%BB%E9%A2%98%E6%96%87%E7%AB%A0%E6%B5%8F%E8%A7%88%E6%AC%A1%E6%95%B0%E6%B7%BB%E5%8A%A0%E5%8D%95%E4%BD%8D/</url>
<content><![CDATA[<h2 id="环境信息"><a href="#环境信息" class="headerlink" title="环境信息"></a>环境信息</h2><ol>
<li>hexo版本:7.3.0</li>
<li>next版本:5.1.4</li>
</ol>
<h2 id="效果预览"><a href="#效果预览" class="headerlink" title="效果预览"></a>效果预览</h2><p>实现浏览次数的单位显示,效果如图</p>
<p><img src="/../images/hexo-next%E4%B8%BB%E9%A2%98%E6%96%87%E7%AB%A0%E6%B5%8F%E8%A7%88%E6%AC%A1%E6%95%B0%E6%B7%BB%E5%8A%A0%E5%8D%95%E4%BD%8D/image-20241023171312372.png" alt="image-20241023171312372"></p>
<h2 id="定位前端代码"><a href="#定位前端代码" class="headerlink" title="定位前端代码"></a>定位前端代码</h2><p>在浏览器中,同时按下Ctrl+Shift+c,选择前端图标元素,找到关键字。</p>
<p><img src="/../images/hexo-next%E4%B8%BB%E9%A2%98%E6%96%87%E7%AB%A0%E6%B5%8F%E8%A7%88%E6%AC%A1%E6%95%B0%E6%B7%BB%E5%8A%A0%E5%8D%95%E4%BD%8D/image-20241023171557749.png" alt="image-20241023171557749"></p>
<p>可以看到关键字是“fa fa-file-o”</p>
<p>在博客根目录搜索关键字,推荐使用vs code打开博客项目搜索,搜索结果如图。</p>
<p><img src="/../images/hexo-next%E4%B8%BB%E9%A2%98%E6%96%87%E7%AB%A0%E6%B5%8F%E8%A7%88%E6%AC%A1%E6%95%B0%E6%B7%BB%E5%8A%A0%E5%8D%95%E4%BD%8D/image-20241023171748595.png" alt="image-20241023171748595"></p>
<p>可以了解到页面统计是“page_pv_header”变量控制的。继续搜索“page_pv_header”变量。</p>
<p><img src="/../images/hexo-next%E4%B8%BB%E9%A2%98%E6%96%87%E7%AB%A0%E6%B5%8F%E8%A7%88%E6%AC%A1%E6%95%B0%E6%B7%BB%E5%8A%A0%E5%8D%95%E4%BD%8D/image-20241023171906996.png" alt="image-20241023171906996"></p>
<p>找到最终代码在“post.swig”文件中。</p>
<h2 id="实现单位添加"><a href="#实现单位添加" class="headerlink" title="实现单位添加"></a>实现单位添加</h2><p>修改<code><span class="busuanzi-value" id="busuanzi_value_page_pv" ></span></code>代码段前后。就可以实现文章浏览次数单位的添加。</p>
<p><img src="/../images/hexo-next%E4%B8%BB%E9%A2%98%E6%96%87%E7%AB%A0%E6%B5%8F%E8%A7%88%E6%AC%A1%E6%95%B0%E6%B7%BB%E5%8A%A0%E5%8D%95%E4%BD%8D/image-20241023172059517.png" alt="image-20241023172059517"></p>
]]></content>
<categories>
<category>hexo博客搭建相关</category>
</categories>
<tags>
<tag>hexo</tag>
<tag>next</tag>
</tags>
</entry>
<entry>
<title>thinkphp5框架学习-访问自定义方法</title>
<url>/2024/10/29/thinkphp5%E6%A1%86%E6%9E%B6%E5%AD%A6%E4%B9%A0-%E8%AE%BF%E9%97%AE%E8%87%AA%E5%AE%9A%E4%B9%89%E6%96%B9%E6%B3%95/</url>
<content><![CDATA[<h2 id="环境搭建"><a href="#环境搭建" class="headerlink" title="环境搭建"></a>环境搭建</h2><ol>
<li>安装phpstudy,版本8.1.1.2,启动Apache2.4.39。</li>
<li>安装composer1.8.5。</li>
</ol>
<p><img src="/../images/thinkphp5%E6%A1%86%E6%9E%B6%E5%AD%A6%E4%B9%A0-%E8%AE%BF%E9%97%AE%E8%87%AA%E5%AE%9A%E4%B9%89%E6%96%B9%E6%B3%95/image-20241029155119237.png" alt="image-20241029155119237"></p>
<ol start="3">
<li>配置系统环境变量。当前php路径:D:\phpstudy_pro\Extensions\php\php5.5.9nts\php.exe,当前composer路径:D:\phpstudy_pro\Extensions\composer1.8.5\composer.bat</li>
</ol>
<p>因此添加以下两个路径到系统环境变量,这样就能在cmd中执行composer命令了<br><code>D:\phpstudy_pro\Extensions\php\php5.5.9nts\</code><br><code>D:\phpstudy_pro\Extensions\composer1.8.5\</code></p>
<p><img src="/../images/thinkphp5%E6%A1%86%E6%9E%B6%E5%AD%A6%E4%B9%A0-%E8%AE%BF%E9%97%AE%E8%87%AA%E5%AE%9A%E4%B9%89%E6%96%B9%E6%B3%95/image-20241029160426862.png" alt="image-20241029160426862"></p>
<ol start="4">
<li>composer全局配置阿里云源。执行以下命令换源。</li>
</ol>
<p><code>composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/</code></p>
<ol start="5">
<li>使用composer安装thinkphp5框架。</li>
</ol>
<p>cd到phpstudy的web根目录。我的web根目录是D:\phpstudy_pro\WWW</p>
<p>执行以下命令开始安装,并将框架目录名命名为think_composer。</p>
<p><code>composer create-project --prefer-dist topthink/think think_composer</code></p>
<p>安装成功的话,应该如图所示。</p>
<p><img src="/../images/thinkphp5%E6%A1%86%E6%9E%B6%E5%AD%A6%E4%B9%A0-%E8%AE%BF%E9%97%AE%E8%87%AA%E5%AE%9A%E4%B9%89%E6%96%B9%E6%B3%95/image-20241029161101169.png" alt="image-20241029161101169"></p>
<h2 id="测试访问"><a href="#测试访问" class="headerlink" title="测试访问"></a>测试访问</h2><p>访问<a href="http://localhost/think_composer/public/">http://localhost/think_composer/public/</a>如果一切配置正常,你会看到如下图界面。其中public文件夹为thinkphp5的web根目录。</p>
<p><img src="/../images/thinkphp5%E6%A1%86%E6%9E%B6%E5%AD%A6%E4%B9%A0-%E8%AE%BF%E9%97%AE%E8%87%AA%E5%AE%9A%E4%B9%89%E6%96%B9%E6%B3%95/image-20241029161258968.png" alt="image-20241029161258968"></p>
<h2 id="添加自定义方法"><a href="#添加自定义方法" class="headerlink" title="添加自定义方法"></a>添加自定义方法</h2><p>那么如何添加自定义的方法呢?</p>
<p>测试修改代码,在application目录下,找到控制器index,添加test方法。</p>
<figure class="highlight php"><table><tr><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="function"><span class="keyword">function</span> <span class="title">test</span>(<span class="params"></span>)</span></span><br><span class="line"><span class="function"></span>{</span><br><span class="line"> <span class="keyword">return</span> <span class="title function_ invoke__">phpinfo</span>();</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<p>这段代码的意思是访问到test方法,就返回phpinfo信息。</p>
<p><img src="/../images/thinkphp5%E6%A1%86%E6%9E%B6%E5%AD%A6%E4%B9%A0-%E8%AE%BF%E9%97%AE%E8%87%AA%E5%AE%9A%E4%B9%89%E6%96%B9%E6%B3%95/image-20241029161818286.png" alt="image-20241029161818286"></p>
<h2 id="访问自定义方法"><a href="#访问自定义方法" class="headerlink" title="访问自定义方法"></a>访问自定义方法</h2><p>接下来就是访问自定义方法。</p>
<p>可以通过以下路径访问到自定义方法。</p>
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">http://localhost/think_composer/public/index.php?s=/index/index/test</span><br><span class="line">http://localhost/think_composer/public/index.php/index/index/test</span><br></pre></td></tr></table></figure>
<p>成功访问,如图所示。</p>
<p><img src="/../images/thinkphp5%E6%A1%86%E6%9E%B6%E5%AD%A6%E4%B9%A0-%E8%AE%BF%E9%97%AE%E8%87%AA%E5%AE%9A%E4%B9%89%E6%96%B9%E6%B3%95/image-20241029162329771.png" alt="image-20241029162329771"></p>
<p><img src="/../images/thinkphp5%E6%A1%86%E6%9E%B6%E5%AD%A6%E4%B9%A0-%E8%AE%BF%E9%97%AE%E8%87%AA%E5%AE%9A%E4%B9%89%E6%96%B9%E6%B3%95/image-20241029162436115.png" alt="image-20241029162436115"></p>
<h2 id="未解决的问题"><a href="#未解决的问题" class="headerlink" title="未解决的问题"></a>未解决的问题</h2><h3 id="问题一:访问不到自定义方法。"><a href="#问题一:访问不到自定义方法。" class="headerlink" title="问题一:访问不到自定义方法。"></a>问题一:访问不到自定义方法。</h3><p>通过以下路径访问不到自定义方法。返回<code>No input file specified.</code>。</p>
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">http://localhost/think_composer/public/index/index/index/test</span><br></pre></td></tr></table></figure>
<p><img src="/../images/thinkphp5%E6%A1%86%E6%9E%B6%E5%AD%A6%E4%B9%A0-%E8%AE%BF%E9%97%AE%E8%87%AA%E5%AE%9A%E4%B9%89%E6%96%B9%E6%B3%95/image-20241029162729018.png" alt="image-20241029162729018"></p>
<p>猜测的原因是未正确配置<code>.htaccess</code>文件。我当前的配置内容为:</p>
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line"><IfModule mod_rewrite.c></span><br><span class="line"> Options +FollowSymlinks -Multiviews</span><br><span class="line"> RewriteEngine On</span><br><span class="line"></span><br><span class="line"> RewriteCond %{REQUEST_FILENAME} !-d</span><br><span class="line"> RewriteCond %{REQUEST_FILENAME} !-f</span><br><span class="line"> RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]</span><br><span class="line"></IfModule></span><br></pre></td></tr></table></figure>
<p>搜索出来的文章说可能有两个原因。1.路由配置问题。2.thinkphp框架解析路径出现问题。<a href="https://blog.csdn.net/qq5201314wx/article/details/118540380">https://blog.csdn.net/qq5201314wx/article/details/118540380</a></p>
<p>慕课网用户给出的解决方案</p>
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">需要设置你的站点伪静态,打开public-.htaccess</span><br><span class="line"></span><br><span class="line">把:RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]</span><br><span class="line"></span><br><span class="line">改成:RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]</span><br><span class="line"></span><br><span class="line">就可以了</span><br></pre></td></tr></table></figure>
<p>尝试修改配置之后还是返回<code>No input file specified.</code>。</p>
<p>最后修改配置成:</p>
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line"><IfModule mod_rewrite.c></span><br><span class="line"> Options +FollowSymlinks -Multiviews</span><br><span class="line"> RewriteEngine On</span><br><span class="line"></span><br><span class="line"> RewriteCond %{REQUEST_FILENAME} !-d</span><br><span class="line"> RewriteCond %{REQUEST_FILENAME} !-f</span><br><span class="line"> RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L]</span><br><span class="line"></IfModule></span><br></pre></td></tr></table></figure>
<p>再访问<code>http://localhost/think_composer/public/index/index/index</code>就正常了</p>
<p><img src="/../images/thinkphp5%E6%A1%86%E6%9E%B6%E5%AD%A6%E4%B9%A0-%E8%AE%BF%E9%97%AE%E8%87%AA%E5%AE%9A%E4%B9%89%E6%96%B9%E6%B3%95/image-20241030143845017.png" alt="image-20241030143845017"></p>
<p><img src="/../images/thinkphp5%E6%A1%86%E6%9E%B6%E5%AD%A6%E4%B9%A0-%E8%AE%BF%E9%97%AE%E8%87%AA%E5%AE%9A%E4%B9%89%E6%96%B9%E6%B3%95/image-20241030143920299.png" alt="image-20241030143920299"></p>
<h3 id="问题二:访问不到其他控制器的方法"><a href="#问题二:访问不到其他控制器的方法" class="headerlink" title="问题二:访问不到其他控制器的方法"></a>问题二:访问不到其他控制器的方法</h3><p>创建admin控制器,添加index方法。</p>
<p><img src="/../images/thinkphp5%E6%A1%86%E6%9E%B6%E5%AD%A6%E4%B9%A0-%E8%AE%BF%E9%97%AE%E8%87%AA%E5%AE%9A%E4%B9%89%E6%96%B9%E6%B3%95/image-20241029164054888.png" alt="image-20241029164054888"></p>
<p>预期结果是访问以下两个路径,返回”this is admin Index index“。</p>
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">http://localhost/think_composer/public/index.php?s=/admin/index/index</span><br><span class="line">http://localhost/think_composer/public/index.php/admin/index/index</span><br></pre></td></tr></table></figure>
<p>但实际访问报错如图。</p>
<p><img src="/../images/thinkphp5%E6%A1%86%E6%9E%B6%E5%AD%A6%E4%B9%A0-%E8%AE%BF%E9%97%AE%E8%87%AA%E5%AE%9A%E4%B9%89%E6%96%B9%E6%B3%95/image-20241029164430785.png" alt="image-20241029164430785"></p>
<p><img src="/../images/thinkphp5%E6%A1%86%E6%9E%B6%E5%AD%A6%E4%B9%A0-%E8%AE%BF%E9%97%AE%E8%87%AA%E5%AE%9A%E4%B9%89%E6%96%B9%E6%B3%95/image-20241029164454118.png" alt="image-20241029164454118"></p>
<p>目前还没找到原因,先继续学习thinkphp5框架后续课程了。</p>
<p>更新,发现原来是Index.php的i没大写,导致找不到控制器。</p>
<p><img src="/../images/thinkphp5%E6%A1%86%E6%9E%B6%E5%AD%A6%E4%B9%A0-%E8%AE%BF%E9%97%AE%E8%87%AA%E5%AE%9A%E4%B9%89%E6%96%B9%E6%B3%95/image-20241029180500309.png" alt="image-20241029180500309"></p>
<p>现在访问以下路径,能看到”this is admin Index index“了。</p>
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">http://localhost/think_composer/public/index.php?s=/admin/index/index</span><br><span class="line">http://localhost/think_composer/public/index.php/admin/index/index</span><br></pre></td></tr></table></figure>
<p><img src="/../images/thinkphp5%E6%A1%86%E6%9E%B6%E5%AD%A6%E4%B9%A0-%E8%AE%BF%E9%97%AE%E8%87%AA%E5%AE%9A%E4%B9%89%E6%96%B9%E6%B3%95/image-20241029180843357.png" alt="image-20241029180843357"></p>
]]></content>
<categories>
<category>php开发</category>
</categories>
<tags>
<tag>thinkphp5</tag>
<tag>php</tag>
</tags>
</entry>
</search>