首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Mantis -导入CSV文件-抛出错误作为应用程序错误#11

Mantis -导入CSV文件-抛出错误作为应用程序错误#11
EN

Stack Overflow用户
提问于 2019-03-02 20:27:37
回答 1查看 117关注 0票数 0

我遇到了下面的错误A必需字段“摘要”为空。请重新检查您的inputs.Can,任何人建议如何继续。

我已经映射了import中的摘要列,但仍然显示错误。

代码语言:javascript
复制
<?php
class Csv_importPlugin extends MantisPlugin
{
    function register() {
        $this->name = plugin_lang_get( 'title' );
        $this->description = plugin_lang_get( 'description' );

        $this->version = '2.0.0';
        $this->requires = array( 'MantisCore' => '2.0.0' );
        $this->author = 'Bug 4220 Team';
        $this->contact = 'https://github.com/mantisbt-plugins/csv-import/';
        $this->url = 'https://github.com/mantisbt-plugins/csv-import/';
        $this->page = 'config';
    }

    function config() {
        return array(
            'import_issues_threshold'   => MANAGER ,
            );
    }

    function hooks() {
        return array(
            'EVENT_MENU_MANAGE' => 'csv_import_menu',
        );
    }

    function csv_import_menu() {
        return array(
            '<a href="' . plugin_page( 'import_issues_page_init' ) . '">' . plugin_lang_get( 'manage_issues_link' ) . '</a>',
        );
    }
}
EN

回答 1

Stack Overflow用户

发布于 2019-03-02 22:47:02

尝尝这个。不需要插件

假设您有一个包含文件列的CSV文件

代码语言:javascript
复制
$file = $_FILES['csv_file']['tmp_name']; //get CSV file
$handle = fopen($file, "r"); //handle
    while(($filesop = fgetcsv($handle, 1000, ",")) !== false){ //start while loop

$sname = $filesop[0];              
$fname = $filesop[1];
$oname = $filesop[2];
$gender= $filesop[3];
$country= $filesop[4];

    // Put your SQL code to insert before while loop ends
    } //end while loop
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54958513

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档