首页 > Web开发 > 详细

PHP学习的坑

时间:2019-04-16 10:06:48      阅读:115      评论:0      收藏:0      [点我收藏+]

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

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

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来访问了

PHP学习的坑

原文:https://www.cnblogs.com/wonder223/p/10714920.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!