Home  >  Article  >  Backend Development  >  这样的写法是如何形成的

这样的写法是如何形成的

WBOY
WBOYOriginal
2016-06-23 13:12:341026browse

比如在地址中输入

http://127.0.0.1/shop/index.php?act=show_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 被解析到同一文件,那么要路径做什么?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn