如何使用php处理这个数组?

发布于 2024-10-14 19:22:23 字数 2327 浏览 1 评论 0原文

我正在从 csv 文件导入用户数据。上传后我得到了这种数组

CRF_Tester_Import_Parser_TesterData Object
(
    [_mapperKeys:protected] => Array
        (
        )

    [_contactIdIndex:private] => 
    [_newTeachers:protected] => Array
        (
        )

    [_fileName:protected] => 
    [_fileSize:protected] => 0.23
    [_seperator:protected] => ,
    [_lineCount:protected] => 5
    [_totalCount:protected] => 4
    [_validCount:protected] => 4
    [_invalidRowCount:protected] => 0
    [_maxErrorCount:protected] => 250
    [_errors:protected] => Array
        (
        )

    [_conflictCount:protected] => 0
    [_conflicts:protected] => Array
        (
        )

    [_duplicateCount:protected] => 
    [_duplicates:protected] => 
    [_warningCount:protected] => 0
    [_maxWarningCount:protected] => 25
    [_warnings:protected] => Array
        (
        )

    [_fields:protected] => 
    [_activeFields:protected] => 
    [_activeFieldCount:protected] => 1
    [_maxLinesToProcess:protected] => 100
    [_rows:protected] => Array
        (
            [0] => Array
                (
                    [0] => Contact ID,First Name,Email,Contribution Type,External Identifier,date,Total Amount
                )

            [1] => Array
                (
                    [0] => 1001,abc,[email protected],aaa,active,2011-1-10,100
                )

            [2] => Array
                (
                    [0] => 1002,fff,[email protected],yes+,active,2010-11-05,200
                )

            [3] => Array
                (
                    [0] => 1003,ggg,[email protected],basic,active,2011-1-20,300
                )

        )

    [_errorFileName:protected] => 
    [_conflictFileName:protected] => 
    [_duplicateFileName:protected] => 
    [_haveColumnHeader:protected] => 
    [_contactType] => Individual
)

从这个数组我如何处理“_rows:protected”键值?

I am importing users data from a csv file. After uploading me got this kind of a an array

CRF_Tester_Import_Parser_TesterData Object
(
    [_mapperKeys:protected] => Array
        (
        )

    [_contactIdIndex:private] => 
    [_newTeachers:protected] => Array
        (
        )

    [_fileName:protected] => 
    [_fileSize:protected] => 0.23
    [_seperator:protected] => ,
    [_lineCount:protected] => 5
    [_totalCount:protected] => 4
    [_validCount:protected] => 4
    [_invalidRowCount:protected] => 0
    [_maxErrorCount:protected] => 250
    [_errors:protected] => Array
        (
        )

    [_conflictCount:protected] => 0
    [_conflicts:protected] => Array
        (
        )

    [_duplicateCount:protected] => 
    [_duplicates:protected] => 
    [_warningCount:protected] => 0
    [_maxWarningCount:protected] => 25
    [_warnings:protected] => Array
        (
        )

    [_fields:protected] => 
    [_activeFields:protected] => 
    [_activeFieldCount:protected] => 1
    [_maxLinesToProcess:protected] => 100
    [_rows:protected] => Array
        (
            [0] => Array
                (
                    [0] => Contact ID,First Name,Email,Contribution Type,External Identifier,date,Total Amount
                )

            [1] => Array
                (
                    [0] => 1001,abc,[email protected],aaa,active,2011-1-10,100
                )

            [2] => Array
                (
                    [0] => 1002,fff,[email protected],yes+,active,2010-11-05,200
                )

            [3] => Array
                (
                    [0] => 1003,ggg,[email protected],basic,active,2011-1-20,300
                )

        )

    [_errorFileName:protected] => 
    [_conflictFileName:protected] => 
    [_duplicateFileName:protected] => 
    [_haveColumnHeader:protected] => 
    [_contactType] => Individual
)

From this array how can I process "_rows:protected" key values?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

错爱 2024-10-21 19:22:23

我猜你因为成员名称中的冒号而遇到问题,请尝试如下:

foreach($CRF_Tester_Import_Parser_TesterData->{'_rows:protected'} as $k=>$item)
{
  echo $item[0];
}

I guess you have problems because of the colon in the member-name, try it like this:

foreach($CRF_Tester_Import_Parser_TesterData->{'_rows:protected'} as $k=>$item)
{
  echo $item[0];
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文