Only variables should be passed by reference

报错位置代码: $status->type = array_pop(explode('\\',$status->type))   (此处$status->type值原本是  APP\Jobs\InboundReportJob)

单独的取值 $status->type  以及执行explode('\\',$status->type) 都没有问题  但是explode('\\',$status->type)作为参数执行array_pop则报错;

原因:array_pop需要引用传参,因为它修改了数组的内部表示形式;而 explode('\\',$status->type) 本身不能作为变量进行引用(reference);

解决方案:  修改代码为

  $arr = explode('\\',$status->type);

  $status->type = array_pop( $arr );

猜你喜欢

转载自www.cnblogs.com/yongbuyanhui/p/10896060.html