March 9, 2015 10:58:42
Controller is the place to accept data assignment tasks
The business receives the data from the controller, obtains and processes The data in the database, and returns it to the logic layer of the controller.
A controller dispatches a task to invoke a business logic layer
The calling notation is:
$this->loadbusiness (' Test ')->test ();
At the same time, business can also call each other:
$this->main->loadbusiness (' Test ')->test ();
Querying data in the database in business:
1 Public function GetName () 2 {3 $where = "' initial ' = ' z '"; 4 $fields = ' name Pinyin initial '; 5 return $this->getlink (' name ')->select ($where$fields); 6 }
where the GetLink () function is the link database to obtain data, the parameter name is the bottom of the configuration file in the 19th row of the array key name:
1 classConfig2 {3 //mysql link param4 Public Static $lcdbparam=Array(5' Host ' = ' 127.0.0.1 ',6' Username ' = ',7' Password ' = ',8 );9 Ten Public Static $remotedbparam=Array( One' Host ' = ', A' Username ' = ', -' Password ' = ', -' Default ' = ' the ); - - //Table Info - Public Static $tableinfo=Array( +' Name ' = = ' Test name Lcdbparam ', -' Tiezi ' = ' bbs tiezi remotedbparam ' + ); A}
Note: The framework does not have a clear model layer, the so-called model layer is the upper database/table configuration file, the real function of the model layer is the business (logic) layer
Business use method of ZPF framework