<code>模型中
namespace
Home\Model;
use
Think\Model;
class
FollowModel
extends
AdvModel{
protected
$partition
=
array
(
'field'
=>
'vid'
,
'type'
=>
'mod'
,
'num'
=>
'2'
);
public
function
getDao(
$data
=
array
()) {
$table
=
$this
->getPartitionTableName(
$data
);
return
$this
->table(
$table
);
}
}
方法中
namespace
Home\Controller;
use
Think\Controller;
class
ActionController
extends
Controller {
public
function
Test() {
$soft_tj_table
= D(
"Follow"
)->getDao(
array
(
'vid'
=>5));
dump(
$soft_tj_table
);
}
}
由于使用了高级模型 返回的表名老是报错
$table
</code>