当我尝试在我的网站上提交表单时,出现以下错误:
致命错误:无法访问第 15 行的函数/form_validation.php 中的空属性
表单验证的代码是:
class Validation {
var $success;
var $post_data;
var $errors;
var $delimiter;
function Validation($HTTP_POST_DATA) {
$this->success = true;
$this->errors = false;
$this->$post_data = $HTTP_POST_DATA;
$this->delimiter = "|";
while(list ($key, $val) = each ($this->$post_data)) {
$this->{$key} = $val;
}
reset($this->$post_data);
while(list ($key, $val) = each ($this->$post_data)) {
if(method_exists($this, $key)) {
$cmd = "\$this->".$key."();";
eval($cmd);
}
}
}
表单页面的代码是:
include_once($APP_ROOT . "functions/index.php");
include_once($APP_ROOT . "functions/form_validation.php");
$CONTINUE = TRUE;
$valid = new Validation($_POST);
if($CONTINUE = $valid->success) {
在我们升级到 PHP5 之前,这段代码可以正常工作。知道我需要改变什么才能让它再次工作吗?
谢谢