【发布时间】:2019-09-18 09:11:13
【问题描述】:
问题是当我将长编码字符串作为参数传递来创建一个类的对象时,我得到了错误,下面是我的代码:-
$job=new ReProcessShipment("PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPFJlcXVlc3Q+
CiAgPFRyYW5zSWQ+NjU3MTA8L1RyYW5zSWQ+CiAgPEFjY291bnRJZD5NWUdPPC9B
Y2NvdW50................."); //8477 charter long encoded string
ReProcessShipment::dispatch($job);
ReProcessShipment 类句柄函数
$request_data['request_data'] = $this->data_get;
$request_data['service'] ='shipment_order_relay';
$webservice_data = Webservice::create($request_data);
try {
$value = urldecode($this->data_get);
$value = base64_decode($value);
$value = str_replace("&", "&", $value);
$result = $this->insert_stg_shipment($value, $webservice_data->id);
} catch (Exception $e) {
$value = base64_decode($this->data_get);
$value = str_replace("&", "&", $value);
$result = $this->insert_stg_shipment($value, $webservice_data->id);
}
在日志中我得到错误:
App\Jobs\ReProcessShipment 类的对象无法转换为 string {"exception":"[object] (ErrorException(code: 0): Object of 类 App\Jobs\ReProcessShipment 无法在
处转换为字符串
【问题讨论】: