#1 ghj386
请问这样行不行?我试过出错function basemanager($mycontrol,$mymodel,$mytable,$mytitle,$mycontents){
class $mymodel extends spModel
{
var $pk = "id"; // 每个留言唯一的标志,可以称为主键
var $table =$mytable; // 数据表的名称
}
class $mycontrol extends spController
function __construct(){ // 公用
parent::__construct(); // 这是必须的
$this->tpl_title = $mytitle;
}
function index(){
}
.........(省略)
}
调用的时候这样:
basemanager($mycontrol="material",$mymodel="materials",$mytable="materials",$mytitle=" 基础设置:物资管理",$mycontents="物资管理详细信息");
我这样调用后,系统出错:
Parse error: parse error, expecting `T_STRING' in E:\SpeedAMP\htdocs\modules\base\material.php on line 3
之所以想这样用,是发现几乎所有的基础表格的管理的操作过程都是一样的,想做个函数,写起来就简便多了。
2010-07-21 10:25:53