请PHP高手解释一下以下代码。

来源:百度知道 编辑:UC知道 时间:2024/09/21 22:43:20
function Remove() {
// 将本功能的权限授给普通管理员和超级管理员 //
$idx = new Auth("1,2");

if (preg_match('/\,$/',$_POST['delid'])) {
$ids = substr($this->postinfo['delid'],0,(strlen($this->postinfo['delid'])-1));
} else {
$ids = $this->postinfo['delid'];
}
$this->query("DELETE FROM article WHERE ID IN($ids)");
if ($affected = mysql_affected_rows()) {
$this->msg("操作成功,成功删除了".$affected.",条记录!","index.php?action=Article");
} else {
throw new Exception("DELETE FROM article WHERE id IN($ids)");
}

非常感谢。。。。

$idx = new Auth("1,2"); //实例化一个类

if (preg_match('/\,$/',$_POST['delid']))//进行正则表达式匹配'/\,$/是判断$
{
$ids = substr($this->postinfo['delid']//传进一个字符串,0//重0开始截取,(strlen($this->postinfo['delid'])-1)//截取到多少位);
} else {
$ids = $this->postinfo['delid']; //调用实例化类中的函数
}
$this->query("DELETE FROM article WHERE ID IN($ids)"); //调用实例化类中的函数发送sql语句
if ($affected = mysql_affected_rows())//判断sql影响的行数,大于1则成功
{
$this->msg("操作成功,成功删除了".$affected.",条记录!","index.php?action=Article");
} else {
throw new Exception("DELETE FROM article WHERE id IN($ids)");
}