Since the company needs project development in PHP, and I have just started using PHP, in the process of writing button submissions, the button events in asp.net are better. First look at the code below,
function Page_Load()
{
echo 'Will run at any time
';
if(!Page::IsPostBack())
{
echo 'Load product category
';
;
}
}
}
function bAdd_Click(){
//Comm::CheckQX('Product Management_Add');
echo "bAdd_Click
";
}
function bEdit_Click()
//Comm::CheckQX('Product Management_Modification');
echo 'proID='.$_GET['proID'].'
echo "bEdit_Click
";
}
function sdfsdfdsf_Click()
echo "e44444444444444444444
";
}
?>
The above code runs the bAdd_Click function when the [Add] button is clicked (let’s call it that, function seems to mean function). Similarly, the bEdit_Click event is automatically run when the [Modify] button is clicked. There is no need for too many parameter changes or too many files. If the page function is not very complex, this mode can be used for rapid development.
Let’s take a look at the code of the EventHelper.php file:
以上功能大家可以测试下,在我php5.4可以运行成功,不过在安全性方面还没考虑过多,看过一些文章php会有可能通过客户端执行php代码,因为php很许多实用的功能特性。
关于Comm::GetParam,由于经常需要获取get方式的参数,或修改参数,如分页时需要保留所有url参数,只修改分页参数(如page=5),所以就自行写了一些代码。
主要利用php以下几个特点:
function_exists
get_defined_functions
以及利用常用的表单提交原理,利用submit提交原理 实现功能的。
由于时间仓促,来不及说明具体原理,还请见谅,代码大家都可以看懂的。