0
我正在將我的頭撞到牆上....我正在做一個簡單的joomla模塊,在helper.php中我不能指定從表單發佈的值。Joomla模塊中的變量
<?php
// no direct access
defined('_JEXEC') or die('Restricted access');
class modReservationHelper {
public $name;
public $email;
public $message;
public $comment;
protected function __construct() {
$this->name = $_POST['fullname'];
$this->email = $_POST['email'];
$this->message = $_POST['message'];
$this->comment = $_POST['comment'];
}
function validateForm() {
echo $this->name; //The output is always 0
echo $this->email+"</br>";//The output is always 0
echo $this->message;//The output is always 0
//When I try
echo $_POST['comment']; // Is correct
}
}
?>
而且我試着不使用構造函數相同的零效果:(
<?php
// no direct access
defined('_JEXEC') or die('Restricted access');
class modReservationHelper {
public $name;
public $email;
public $message;
public $comment;
function getValues() {
$this->name = $_POST['fullname'];
$this->email = $_POST['email'];
$this->message = $_POST['message'];
$this->comment = $_POST['comment'];
}
function validateForm() {
modReservationHelper::getValues;
echo $this->name; //The output is always 0
echo $this->email+"</br>";//The output is always 0
echo $this->message;//The output is always 0
//When I try
echo $_POST['comment']; // Is correct
}
}
?>
整個過程是由被稱爲 「mod_wreservation.php」 我叫modReservationHelper :: validateForm();
你好嗎調用類modreservationHelper的函數? – Gaurav 2011-01-27 09:13:02
請參閱上面的編輯。 – Jim 2011-01-27 09:25:29