Kneel beg PHP Warrior, do not understand can help the top to solve the idea

Source: Internet
Author: User
Kneel beg PHP Warrior, do not understand can help top down
In PHP, the business process is separated from the logical zone, which is implemented by these control,tpl,php together to achieve a page!!!

The code in the class now
PHP Code
  
   Class HR {    function __construct () {} public    static function Get_emp_list ($CID) {//I typically return DB with static functions                :: GetAll (' select * from Erp_employee where cid= '. Db::quote ($cid));        DB is the database operation class            }    }

"__control.php" in the controller.
PHP Code
  
   Public Function default_action () {        $hr = new hr;        $empid = "S0001";        [color= #FF0000] $info = $hr->get_emp_list ($empid); [/color]  [[color= #0000FF] How does this know what's in 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]

My page how to go to the data ah ". TPL"????
PHP Code
  
       
  
   
   
Employee Serial Number
  • <{$arg 1}>
Nickname
<{$arg 2}>


------Solution--------------------
MVC spreads data in the form of structs.
------Solution--------------------
Arrays are Pirnt_r or var_dump.
------Solution--------------------
PHP Code
  
           
  
   
   
Employee Serial Number
  • <{$arg 1}>
Nickname
<{$arg 2}>
EOT;? >
------Solution--------------------
Do you use the smarty, or do you manually write the template?
------Solution--------------------
You just gave the code snippet and couldn't do the test.

Please indicate what problem you have encountered.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    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.