跪求php大俠,不懂可以幫忙頂下解決思路

來源:互聯網
上載者:User
跪求php大俠,不懂可以幫忙頂下
php中將業務處理跟邏輯區分開,分別由這些control,tpl,php共同實現一個頁面!!!

現在類中的code
PHP code
class HR {    function __construct(){}    public static function get_emp_list($cid){//我一般用靜態函數                return DB::getAll('select * from erp_employee where cid='.DB::quote($cid));        //DB為資料庫操作類            }    }

控制器中【__control.php】的
PHP code
public function default_action(){        $hr = new HR;        $empid = "S0001";        [color=#FF0000]$info = $hr->get_emp_list($empid);[/color]  //[[color=#0000FF]這個怎麼知道Info裡有啥啊[/color]?]                $args=array('arg1' => $empid,'arg2' => 'aaaaaaaaa');        //$args['empinfo'] = $info;        $this->show_page('index',$args);            }        public function show_page($tpl,$data=null,$return=false){        if(!is_null($data) && is_array($data)){            foreach($data as $key=>$item)[code=PHP]
{
$this->page->add($key,$item);
}
}
$this->page->name=$tpl;
if($return){
return $this->page->fetch();
}else{
$this->page->show();
}
}
[/code]

我頁面如何去資料啊【.tpl中】????
PHP code
    
  
員工流水號
  • <{$arg1}>
暱稱
<{$arg2}>


------解決方案--------------------
mvc都是以struct等形式傳資料的。
------解決方案--------------------
數組要pirnt_r或者var_dump.
------解決方案--------------------
PHP code
        
  
員工流水號
  • <{$arg1}>
暱稱
<{$arg2}>
EOT;?>
------解決方案--------------------
你是用的smarty,還是自己手動寫的模板呢?
------解決方案--------------------
你只給出了程式碼片段,無法做測試

請說明你遇到了什麼問題

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.