我有一個名爲function.php文件具有這樣的功能:php如何將字符串/變量傳遞給函數?
public function issue_challenge()
{
$conn= fns_connect(13);
mysql_select_db("et_games",$conn);
$sql = "insert into challengers (challenger,defender,stake,matching_game_id) values (".$this->talentnum_self.",".$this->talentnum_other.",".$this->stake.",'".$this->matching_str()."')";
$result = mysql_query($sql);
echo $sql; mysql_error();
if($result){
echo "ok.\n";return true;
}else{
return false;
}
}
並具有一種形式,它的另一個文件名爲test.php的。
如何將該表單中的值傳遞給該函數?
我正在尋找關於如何將字符串/變量傳遞給函數的一些通用答案。
感謝
'使用functionName( '我是一個字符串');'傳遞一個字符串,'使用functionName($ iAmAVariable);'傳遞變量 – Zirak 2011-05-09 17:14:34