TP6数据集链式操作(order)对integer字段操作错误

浏览:1691 发布日期:2020/03/20 分类:ThinkPHP6专区
版本6.0.2
数据集内容如下:

^ array:24 [
      0 => array:13 [
        "id" => 1
        "title" => "语文"
        "jiancheng" => "语"
        "lieming" => "yuwen"
        "category" => "1011001"
        "kaoshi" => 1
        "paixu" => 1
        "status" => 1
        "beizhu" => null
        "create_time" => "2018-10-10 16:08:38"
        "update_time" => "2018-10-10 16:08:38"
        "delete_time" => null
        "sbjCategory" => array:2 [
          "id" => 1011001
          "title" => "语文"
        ]
      ]
    1 => array:13 [
        "id" => 2
        "title" => "数学"
        "jiancheng" => "数"
        "lieming" => "shuxue"
        "category" => "1011002"
        "kaoshi" => 1
        "paixu" => 2
        "status" => 1
        "beizhu" => null
        "create_time" => "2018-10-10 16:08:38"
        "update_time" => "2018-10-10 16:08:38"
        "delete_time" => null
        "sbjCategory" => array:2 [
          "id" => 1011002
          "title" => "数学"
        ]
      ]
复制代码
代码如下:

 $obj = $obj->order('id', $src['order']);  #$obj为上面的数据集复制代码
试了一下,id,kaoshi,paixu,status这几个字段不好用,错误提示如下:

message    "strcmp() expects parameter 1 to be string, int given"
    name    "TypeError"
    file    "C:\\phpstudy_pro\\WWW\\x.cj.cn\\vendor\\topthink\\think-helper\\src\\Collection.php"
   line 518
最佳答案
评论( 相关
后面还有条评论,点击查看>>