1)IIS8中设置thinkphp直接使用Control/class/function的方法访问网址

2)无法链接到某个Control/class/function

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

1)IIS8中设置thinkphp5直接使用Control/class/function的方法访问网址

    环境:iis8+php5.6+thinkphp5.1 

    问题的表现:无法使用这种方法访问

    解决过程:1.1)按照网上的方法,确认thinkphp能正常工作,能够正确显示thinkphp的欢迎页面,修改index/index/index方法里面的内容,欢迎页面是有反映的

                   1.2)找到网上的web.config中增加这个配置,但是好像也没有什么用

       <rewrite>
            <rules>
                <rule name="OrgPage" stopProcessing="true">
                    <match url="^(.*)$" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{HTTP_HOST}" pattern="^(.*)$" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php/{R:1}" />
                </rule>
            </rules>
        </rewrite>

           1.3)在其他地方看到直接输入网址 public/index.php/Control/class/function  这种方法可以正常访问

                1.4)其它地方说到修改route/route.php,结果进去修改还是不行的。猜想的原因是public/index.php是启动文件,都没有启动,route/route.php无法作用起来.

                1.5)看到其它地方说到在根目录下增加一个index.php之类,突然有想法了,将上面的

<action type="Rewrite" url="index.php/{R:1}" />
修改为
<action type="Rewrite" url="public/index.php/{R:1}" />

            1.6)于是,可以正常工作了

     2)无法链接到某个Control/class/function

        问题描述:index/user/hello 这个方法访问就出错

        问题解决过程:

              2.1)修改另外一个方法,比如index/user/hellot ,这个是没有任何问题的,但是就是index/user/hello方法不行

              2.2)仔细查找,想起之前在route.php有设定             

Route::get('hello2','index/user/hello');

         2.3)去掉这行,发现正常访问了

             2.4)再加上这行,又无法访问了

         总结规律:在route.php中有影射的,就可以使用Control/class/function来访问了

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄