Php json_encode():laravel中参数中的UTF-8序列无效

Php json_encode():laravel中参数中的UTF-8序列无效,php,arrays,json,laravel,utf-8,Php,Arrays,Json,Laravel,Utf 8,我在laravel中执行dd($somevariable)时得到了以下结果 array:12 [ 0 => {#223 +"jobinspt_post_questions_id": 117 +"category": "Fascia & Gutter" +"question": "The F&G is complete" +"subquestion": null +"passed": null +"rectification

我在laravel中执行dd($somevariable)时得到了以下结果

array:12 [
  0 => {#223
    +"jobinspt_post_questions_id": 117
    +"category": "Fascia & Gutter"
    +"question": "The F&G is complete"
    +"subquestion": null
    +"passed": null
    +"rectification": null
    +"catpassed": "N"
  }
  1 => {#224
    +"jobinspt_post_questions_id": 118
    +"category": "Fascia & Gutter"
    +"question": "Temporary props are in use"
    +"subquestion": null
    +"passed": null
    +"rectification": null
    +"catpassed": "N"
  }
  2 => {#225
    +"jobinspt_post_questions_id": 119
    +"category": "Fascia & Gutter"
    +"question": "The F&G is straight, level and undamaged"
    +"subquestion": null
    +"passed": null
    +"rectification": null
    +"catpassed": "N"
  }
  3 => {#226
    +"jobinspt_post_questions_id": 120
    +"category": "Fascia & Gutter"
    +"question": "F&G at correct height and distance from frame"
    +"subquestion": null
    +"passed": null
    +"rectification": null
    +"catpassed": "N"
  }
  4 => {#227
    +"jobinspt_post_questions_id": 121
    +"category": "Fascia & Gutter"
    +"question": "Dutch gables are cut neatly and level"
    +"subquestion": null
    +"passed": null
    +"rectification": null
    +"catpassed": "N"
  }
  5 => {#228
    +"jobinspt_post_questions_id": 122
    +"category": "Fascia & Gutter"
    +"question": "All rafter brackets are installed"
    +"subquestion": null
    +"passed": null
    +"rectification": null
    +"catpassed": "N"
  }
  6 => {#229
    +"jobinspt_post_questions_id": 123
    +"category": "Fascia & Gutter"
    +"question": "All barge gutters/ returns are installed"
    +"subquestion": null
    +"passed": null
    +"rectification": null
    +"catpassed": "N"
  }
  7 => {#230
    +"jobinspt_post_questions_id": 124
    +"category": "Fascia & Gutter"
    +"question": "Hips and jacks are propped"
    +"subquestion": null
    +"passed": null
    +"rectification": null
    +"catpassed": "N"
  }
  8 => {#231
    +"jobinspt_post_questions_id": 125
    +"category": "Fascia & Gutter"
    +"question": "Ext & Int corners are installed"
    +"subquestion": null
    +"passed": null
    +"rectification": null
    +"catpassed": "N"
  }
  9 => {#232
    +"jobinspt_post_questions_id": 126
    +"category": "Fascia & Gutter"
    +"question": "Rake downs/ laybacks/drag downs installed"
    +"subquestion": null
    +"passed": null
    +"rectification": null
    +"catpassed": "N"
  }
  10 => {#233
    +"jobinspt_post_questions_id": 127
    +"category": "Fascia & Gutter"
    +"question": b"Rivets – correct colour and number"
    +"subquestion": null
    +"passed": null
    +"rectification": null
    +"catpassed": "N"
  }
  11 => {#234
    +"jobinspt_post_questions_id": 128
    +"category": "Fascia & Gutter"
    +"question": "Downpipes pops or drops installed as per plan"
    +"subquestion": null
    +"passed": null
    +"rectification": null
    +"catpassed": "N"
  }

]
当我将这个数组编码为json时,我得到了以下错误

json_encode():参数中的UTF-8序列无效


我不知道那个无效的utf8序列在哪里。请帮助我找出此阵列的错误所在

如果您使用的是MYSQL,请尝试以下操作

$con = mysqli_connect('localhost', 'my_user', 'my_password', 'test');
mysqli_set_charset($con, 'utf8');

查看阵列转储中的元素10:

+"question": b"Rivets – correct colour and number"
有一个“b”字符需要删除