第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

php訪問(wèn)嵌套函數(shù)中的foreach變量

php訪問(wèn)嵌套函數(shù)中的foreach變量

PHP
郎朗坤 2022-10-28 16:29:12
function processImages($images){$uploadfiles = array();// make sure images array does not contain more than 3 imagesif (count($images) <= 3) {    foreach ($images as $image) {        $uploadfile = "NULL";        if ($image['size'] != 0) {            //file process            function doFileCheck($file, $image)            {                $imginfo_array = getimagesize($file);                /*getimagesize() only works with imagesif getimagesize() fails it will returnfalse you can use var_dump() to see insidethe array.echo var_dump($imginfo_array)  */                if ($imginfo_array !== false) {                    $uploaddir = './uploads/';                    $uploadfile = $uploaddir . basename($image['name']);                    if (file_exists($uploadfile)) {                        echo "<h3>That filename already exists - try again!</h3>";                    } else {                        if (move_uploaded_file($image['tmp_name'], $uploadfile)) {                            echo "<h3>File seems valid, and was successfully uploaded</h3>";                        } else {                            echo "INVALID! Possible file upload attack!\n";                        }                    }                    return $uploadfile;                }            }我有這個(gè)文件處理函數(shù),問(wèn)題是我得到一個(gè)異常,說(shuō)只有變量應(yīng)該通過(guò)引用傳遞。在第一種情況下,它會(huì)在 switch 語(yǔ)句中引發(fā)該異常,因?yàn)槲艺趪L試上傳 jpeg 圖像,但我正在調(diào)試它并且找不到問(wèn)題。我將一個(gè)數(shù)組傳遞給包含表單中每個(gè)文件(總共 3 個(gè))的函數(shù),然后遍歷文件以處理每個(gè)文件
查看完整描述

1 回答

?
胡子哥哥

TA貢獻(xiàn)1825條經(jīng)驗(yàn) 獲得超6個(gè)贊

閱讀有關(guān)array_push()的更多信息。

您正在傳遞 adoFileCheck($file, $image)而不是$array_of_varsand $new_element_in_array_of_vars

BTW$array_of_vars[] = $new_element_in_array_of_vars;的工作速度比array_push($array_of_vars,$new_element_in_array_of_vars);.


查看完整回答
反對(duì) 回復(fù) 2022-10-28
  • 1 回答
  • 0 關(guān)注
  • 116 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)