我有一個代碼PHP文件,而不是附加statment
if(count($_FILES) > 0) {
foreach($_FILES['fileAttach']['error'] as $status){
if($status === UPLOAD_ERR_OK) {
$fname[] = $_FILES['fileAttach']['name'][$Ccount];
$tmp_path[] = $_FILES['fileAttach']['tmp_name'][$Ccount];
$ftype[] = $_FILES['fileAttach']['type'][$Ccount];
}
$Ccount++;
}
} else { $fname[] = "0"; $tmp_path[] = "0"; $ftype[] = "0"; } // this not working
然後我想在功能
SendEmails($ReCEmail,$strSubject,$strMessage,$txtFormName,$txtFormEmail,$fname,$ftype,$tmp_path);
它的工作原理,直到文件安裝到使用變量,但如果沒有我得到錯誤Notice: Undefined variable: fname in ... on line ..
function SendEmails($vasia,$strSubject,$strMessage,$txtFormName,$txtFormEmail,$fname,$ftypes,$tmp_path) {
if(count($fname) == 0)
{ code without variables $fname,$ftypes,$tmp_path }
else {code with variables $fname,$ftypes,$tmp_path}
}
如何解決這個問題?
有什麼不同?不行! –
我回答中回聲的輸出是什麼? – Tim
相同的回聲,沒有不同 –