小编Lau*_*rer的帖子

在Wordpress Admin中从PHP数组创建"下载到CSV"按钮

我已经使用函数填充了一个多维PHP数组,我希望允许我的管理员用户下载内容.

我找到了一个PHP函数,它允许我将数组导出为CSV并将其放在我的functions.php中,使用第二个函数将其挂钩到AJAX并使用jQuery来激活AJAX函数.

有什么问题?

所以我99%肯定AJAX正确发布到PHP函数,但由于某种原因下载没有启动.

我已经研究了很多,但很难找到解决方案 - 真的很欣赏正确方向的一点!

// Function to generate download

function convert_to_csv( $input_array, $output_file_name, $delimiter ) {
    /** open raw memory as file, no need for temp files, be careful not to run out of memory thought */
    $f = fopen( 'php://memory', 'w' );
    /** loop through array  */
    foreach ( $input_array as $line ) {
        /** default php csv handler **/
        fputcsv( $f, $line, $delimiter );
    }
    /** rewrind the "file" with the csv lines **/
    fseek( …
Run Code Online (Sandbox Code Playgroud)

javascript php ajax wordpress jquery

3
推荐指数
1
解决办法
1693
查看次数

如何在PhpStorm 2019中设置Bitbucket

术语Git,存储库,提交和推送对我来说是全新的,但是我想为我的WordPress网站设置版本控制系统。

我使用PhpStorm,并想使用Bitbucket-我该怎么做?

(我已经花了一个下午的时间回答上述问题,因此将在下面分享)

git wordpress bitbucket phpstorm

3
推荐指数
1
解决办法
1879
查看次数

标签 统计

wordpress ×2

ajax ×1

bitbucket ×1

git ×1

javascript ×1

jquery ×1

php ×1

phpstorm ×1