下面的函數工作正常,沒有返回變量的值,而不是隻給$reslt
字符串中的變量$field
返回值:函數的字符串
function req($slice,$field)
{
if ($slice == "") {
$reslt = $field. ' cannot be empty<br />';
return $reslt;
}else{
$reslt = "";
return $reslt;
}
}
req($slice,$field);
$err_mess = req();
echo $err_mess; // gives me 'cannot be empty' as result but does not show the value for the '$field' variable included in the string
,這意味着你的$字段變量也是空 – Surace
@Surace不,沒有,我檢查了,它得到了價值 – Manu
如果有一個句點(。)後四小時行的$字段? $ reslt = $字段。 –