我也验证$type
并使用get/set
.
private function somfunc($sql) {
// query and return result set as an array
}
private function mytype($type) {
switch ($type)
case topic: $sql="......";
return sql;
}
public function display($type) {
// switch case to require template
// call somefunc and mytype here
}
如果它不安全,我该如何改进我的代码?