假如我有这么一个跳转 : index.php?app=goods&act=drop他从 index.php -> ECMall 的 startup方法 -> 这时会请求 GoodsApp 这个类中的 do_action 方法, 因为这个类中没有, 所以去找父类, 然后一个一个父亲往上找 -> 直到找到 ECBaseApp 才出现第一个 do_action 方法, 但是他又 parent::do_action($action); -> 所以我又跑到 BaseApp 找, 总算不跳了, 但是$this->_run_action(); 也让我傻眼:    function _run_action()
    {
    
        $action = $this->_curr_action;
        $this->$action();
    }
我输出了这里的 $action, 的确是 drop, 但是这个类中并没有 drop(), 而且父类里面也没有 drop, 程序这时又跳到哪里去了呢? 这时难道往下(子类)跳了吗? 太奇怪了! 请PHP/ECMALL高手指点, 刚刚接触 php 不久,很困惑, 非常感谢你的帮助

解决方案 »

  1.   

    没人2次开发 ecmall 吗? 顶一下
      

  2.   

    在app/goods.app.php文件中找到drop()就OK了。
      

  3.   

    也算是快刀斩乱麻, 再问你个小问题就给分:在ecmall html中有这些模板语言:
    <!--{foreach from=$goods_list item=goods}-->
    <!-- {if $goods.if_show} -->这样的变量 $goods_list, 上下文都没出现过, 我要怎么知道这些变量是哪里来的呢?回答要比较详细一点
      

  4.   


    /* 店铺分类 */
        function store()
        {
            /* 取得导航 */
            $this->assign('navs', $this->_get_navs());
            /* 取得商品分类 */
            $scategorys = $this->_list_scategory();
            /* 取得最新店铺 */
            $new_stores = $this->_new_stores(5);
            /* 取得推荐店铺 */
            $recommended_stores = $this->_recommended_stores(5);
            /* 当前位置 */
            $_curlocal=array(
                array(
                    'text'  => Lang::get('index'),
                    'url'   => 'index.php',
                ),
                array(
                    'text'  => Lang::get('scategory'),
                    'url'   => '',
                ),
            );
            $this->assign('_curlocal',$_curlocal);
            $this->assign('new_stores', $new_stores);
            $this->assign('recommended_stores', $recommended_stores);
            $this->assign('scategorys', $scategorys);        $this->assign('page_title', Lang::get('store_category') . ' - '. Conf::get('site_title'));
            $this->display('category.store.html');在drop()中也有类似的$this->assign('goods_list', $var);
    类似于smarty的使用方式
      

  5.   

    不错, 原来这样 assign 的, O(∩_∩)O哈!
      

  6.   

    我有一个地方没明白,当$action=drop时,不是相当于$this->drop()这样么?为什么要到app/goods.app.php文件中找呢?这个时候的$this->调用的不应该是当前类的方法么?