求教:我在用微信支付時(shí),經(jīng)常出現(xiàn)報(bào)錯:容器異常: Target [Psr\Container\ContainerInterface] is not instantiable while building [Yansongda\Supports\Pipeline]
$config = config('pay');
try {
Pay::config($config);
$pay_order = [
'out_trade_no' => $out_trade_no . '',
'description' => $order->body,
'amount' => [
'total' => intval($order->total_fee*100),
'currency' => 'CNY',
],
'payer' => [
'openid' => $order->openid,
]
];
$result = Pay::wechat()->mini($pay_order);
info(json_encode($pay_order));
} catch (ContainerException $e) {
info('wechat_pay_create_order:'.$e->getMessage().$out_trade_no);
info(json_encode($pay_order));
return json(['code'=>'err','msg'=>'支付異常,請重試','message'=>$e->getMessage()]);
}
容器異常: Target [Psr\Container\ContainerInterface] is not instantiable while building [Yansongda\Supports\Pipeline]
workerman/webman 1.6.1
基本解決,在業(yè)務(wù)代碼中加上這個(gè):
Pay::config(config('pay'));
$container = \Illuminate\Container\Container::getInstance();
$container->instance(\Psr\Container\ContainerInterface::class, $container);