• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

这样的写法是如何形成的

php 搞代码 4年前 (2022-01-23) 14次浏览 已收录 0个评论
文章目录[隐藏]

比如在地址中输入

http://127.0.0.1/shop/index.php?act=s%本文来源gaodai#ma#com搞*代#码9网#搞gaodaima代码how_groupbuy&op=index

http://127.0.0.1/index.php?act=show_groupbuy&op=index
是一样的
这说明去掉文件夹也可以,但是我读了一下控制器,没有发现替换的写法呢?

控制器如下

/**     * 控制器调度     *     */    private static function control() {        //二级域名        if ($GLOBALS['setting_config']['enabled_subdomain'] == '1' && $_GET['act'] == 'index' && $_GET['op'] == 'index') {            $store_id = subdomain();            if ($store_id > 0)                $_GET['act'] = 'show_store';        }        $act_file = realpath(BASE_PATH . '/control/' . $_GET['act'] . '.php');        $class_name = $_GET['act'] . 'Control';        if (!@include($act_file)) {            if (C('debug')) {                throw_exception("Base Error: access file isn't exists!");            } else {                showMessage('抱歉!您访问的页面不存在', '', 'html', 'error');            }        }        if (class_exists($class_name)) {            $main = new $class_name();            $function = $_GET['op'] . 'Op';            if (method_exists($main, $function)) {                $main->$function();            } elseif (method_exists($main, 'indexOp')) {                $main->indexOp();            } else {                $error = "Base Error: function $function not in $class_name!";                throw_exception($error);            }        } else {            $error = "Base Error: class $class_name isn't exists!";            throw_exception($error);        }    }​

回复讨论(解决方案)

这是 url 重写造成的
也可能是你配置虚拟主机时未对主站做配置

这是 url 重写造成的
也可能是你配置虚拟主机时未对主站做配置

你说的这些我都没有做,再说如果我做这些说明我肯定懂里面的道理,那我也不会发此帖了。有时要推理别人的思维!

那你是真懂还是假懂?
路径不同就不可能解析到同一文件
如果 shop/index.php 和 admin/index.php 被解析到同一文件,那么要路径做什么?


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:这样的写法是如何形成的
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址