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

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

我在 php 中創(chuàng)建 csv 文件的功能通過但不創(chuàng)建文件

我在 php 中創(chuàng)建 csv 文件的功能通過但不創(chuàng)建文件

PHP
繁華開滿天機(jī) 2022-06-11 18:04:59
嘿伙計(jì)們,這是我的代碼。        function markenbuero_csv() {        // open the file "demosaved.csv" for writing        $file = fopen('demosaved.csv', 'w');        // save the column headers        fputcsv($file, array('Column 1', 'Column 2', 'Column 3', 'Column 4', 'Column 5'));        // Sample data. This can be fetched from mysql too        $data = array(            array('Data 11', 'Data 12', 'Data 13', 'Data 14', 'Data 15'),            array('Data 21', 'Data 22', 'Data 23', 'Data 24', 'Data 25'),            array('Data 31', 'Data 32', 'Data 33', 'Data 34', 'Data 35'),            array('Data 41', 'Data 42', 'Data 43', 'Data 44', 'Data 45'),            array('Data 51', 'Data 52', 'Data 53', 'Data 54', 'Data 55')        );        // save each row of the data        foreach ($data as $row)        {        fputcsv($file, $row);        }        // Close the file        fclose($file);          echo 'worked';    }我通過我的 Wordpress 自定義插件頁面中的表單調(diào)用它,它呼應(yīng)了“工作”,但沒有在我的插件文件夾中創(chuàng)建文件。表單如下所示:<form style="margin-top:50px" action="#" method="post"> <input type="submit" name="a_submit" value="CSV laden"></form>和我稱之為的方式:if(isset($_POST['a_submit'])){            markenbuero_csv();        }我不確定我錯(cuò)過了什么。感謝您幫助我。
查看完整描述

1 回答

?
慕少森

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

使用絕對(duì)路徑來確保文件在正確的位置


$path = realpath('./your-directory') . DIRECTORY_SEPARATOR . 'demosaved.csv';

$file = fopen($path, 'w');


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

添加回答

舉報(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)