下面是我一直在嘗試的一些代碼,我已經搞砸了,包括die()和echo()在這裏和那裏,但沒有任何反應,如果我試着運行別人的類代碼,並且可以正常工作,但是我看不出我的代碼有什麼問題。當我使用PHP類時,什麼也沒有發生
class Form {
private $form_method;
public function __construct()
{
$form_method = '';
}
public function setFormMethod($method)
{
$this->$form_method=$method;
}
public function getFormMethod()
{
return $this->$form_method;
}
}
$newForm = new Form();
$newForm->setFormMethod('POST');
$var = getFormMethod();
echo $var;
我在本地主機上通過XAMPP運行PHP 5.3.2。
任何幫助讚賞
你有沒有PHP的標籤呢? – Catfish 2010-07-01 21:03:16