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

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

瀏覽器不會(huì)顯示新文件 - PHP

瀏覽器不會(huì)顯示新文件 - PHP

湖上湖 2023-08-29 18:03:26
我正忙于修復(fù)每次顯示文件時(shí)都會(huì)顯示點(diǎn)的錯(cuò)誤。修復(fù)錯(cuò)誤后,點(diǎn)不再顯示,而是顯示我上傳的第一個(gè)文件。但是,當(dāng)我想上傳新文件時(shí),它不顯示。舊文件仍保留在那里(應(yīng)顯示兩個(gè)文件)。我曾經(jīng)Continue修復(fù)過顯示的點(diǎn)。我的 PHP 代碼:<?phpif ( empty( $_FILES['file'] ) ) {?><html>  <head>  </head>  <body>    <form action="" enctype="multipart/form-data" method="post">      <input name="file" type="file"/>      <br>      <input name="submit" type="submit" value="Upload uw album" />    </form>  </body></html><?phpreturn;} else {?><html>  <head>  </head>  <body>    <form action="" enctype="multipart/form-data" method="post">      <input name="file" type="file"/>      <br>      <input name="submit" type="submit" value="Upload uw album" />    </form>  </body></html><?php}// Connectiegegevens$ftp_server = "myserver";$ftp_user_name = "myuser";$ftp_user_pass = "mypass";$source_file = $_FILES['file']['tmp_name'];$destination_folder = "/public_html/wp/wp-content/plugins/AbonneerProgrammas/Albums";$destination_file = $destination_folder . "/" . basename($_FILES['file']['name']);$conn_id = ftp_connect($ftp_server);// login with username and password$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); ftp_pasv($conn_id, true); // check connectieif ((!$conn_id) || (!$login_result)) {     echo "Het spijt ons, er is momenteel geen connectie met de server.";    // echo "Attempted to connect to $ftp_server for user $ftp_user_name";     exit; } else {     // echo "upload is gelukt";}// upload het bestand$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);// check upload status if (!$upload) { echo "Er is iets fout gegaan, excuses voor het ongemak";} else {// weergeef het bestand & download$contents = ftp_nlist($conn_id, $destination_folder);   foreach ($contents as $mp3_url) {     $filename = basename($mp3_url, ".mp3");// Dit zorgt ervoor dat de punten niet te zien zijn    if($filename == "." && "..") {    continue;    print_r($filename);   }    }?>
查看完整描述

1 回答

?
函數(shù)式編程

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

您正在使用 foreach 循環(huán)來獲取數(shù)據(jù):


foreach ($contents as $mp3_url) { 

    $filename = basename($mp3_url, ".mp3");

// Dit zorgt ervoor dat de punten niet te zien zijn

    if($filename == "." && "..") {

    continue;

    print_r($filename);

   }

但是這樣您只顯示該循環(huán)最后一次迭代的結(jié)果:


   <tr>

     <td><?php echo "<a href='$mp3_url'>$filename</a>"; ?></td>

   </tr>

嘗試:


$filenames = [];

foreach ($contents as $mp3_url) { 

    // {...} your remaining code

    $filenames[] = $mp3_url;

}

進(jìn)而


foreach ($filenames as $filename) {

    echo $filename;

}

將這些文件名存儲(chǔ)在數(shù)組中而不是字符串中將使您能夠迭代它們。


查看完整回答
反對 回復(fù) 2023-08-29
  • 1 回答
  • 0 關(guān)注
  • 133 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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