【问题标题】:how to make file redirect to to page after success process成功过程后如何使文件重定向到页面
【发布时间】:2019-02-25 10:28:57
【问题描述】:

我正在使用 php 7.2laravel 5.5

这是我的 blade.php 那里的问题

    @extends(MyHelper::siteTheme('billing_waiting'))

@section('contentBlock')

    <h3>
        {{trans('site.blockchain.send')}} <span style="color:red">{{ $form_data['amount']}} </span>BTC <br>
        {{trans('site.blockchain.to')}} <span style="color:red">{{ $form_data['sendto']}} </span>
    </h3>
    <br>
    <br>
    <h2>{{trans('site.blockchain.scan')}}</h2>
    {!!  $form_data['code']  !!}
    <br>
    <br>
    <h3 style="color: red;">** {{trans('site.blockchain.confirmations')}}</h3>

@endsection

这是我的回调文件

if ($order->btc_amo==$value_in_btc && $secret=="ABIR" && $confirmations >= 1){

                $savedata['confirmation'] = $trx_hash;
                $savedata['gateway_response'] = json_encode($request->all());
                $savedata['status'] = 'paid';}

现在我想让 blade.php 在回调返回成功时返回到特定页面 表示当

($order->btc_amo==$value_in_btc && $secret=="ABIR" && $confirmations >= 1) 返回成功页面

提前致谢

编辑:

我希望在回调文件中支付成功时刷新刀片文件并转到特定页面

这是我的完整回调文件

$track = $request->input('invoice_id');
            $secret = $request->input('secret');
            $value = $request->input('value');
            $confirmations = $request->input('confirmations');
            $value_in_btc = $value / 100000000;
            $trx_hash = $request->input('transaction_hash');

            $order = Transaction::where('hash',$track)->first();

            if($order->status == 0){
                
                if ($order->btc_amo==$value_in_btc && $secret=="ABIR" && $confirmations >= 1){
                    $savedata['confirmation'] = $trx_hash;
                    $savedata['gateway_response'] = json_encode($request->all());
                    $savedata['status'] = 'paid';

                    //Update product sales
                    $this->salesupdate($order->product_id);
                    //Save order
                    $this->neworder($order->user_id,$order->product_id,$order->price,$order->hash,$order->id);
                    //Save user transaction
                    $this->newusertransaction($order->user_id,$order->price);
                    //Credit seller
                    $this->creditseller($order->product_id);
                    // add balance to user
                    $this->addbalancetouser($order->user_id,$order->price);
                    //Update order
                    $order->update($savedata);

                    
                }
            }

【问题讨论】:

  • 您能否详细说明一下。你到底想做什么?
  • 我希望付款成功后刀片文件返回到特定页面
  • 好的,你不能重定向到刀片文件。您需要创建一个路由,并且针对该路由,您需要创建一个函数并加载刀片模板并重定向到这样的链接 return redirect('your_route');
  • 您是否有机会通过 ajax 发出请求(向您的回调)?

标签: javascript php html laravel laravel-blade


【解决方案1】:

你的问题有点不清楚。您可以使用redirect('url') 重定向到另一个页面,如果您需要发送一些数据,您可以使用with()。所以就在回调结束时你这样做,

return redirect('your-page-url')

您可以在docs找到更多信息

希望这会有所帮助!

【讨论】:

  • 当进程从回调文件成功时,这在我想要重定向的刀片文件中不起作用
  • 那么你需要使用java script ans ajax来提出你的请求和重定向
【解决方案2】:

返回

redirect("route of url") 

成功时指向该特定网址

【讨论】:

  • 这在我想在进程成功时进行重定向的刀片文件中不起作用
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-04-08
  • 2013-02-12
  • 1970-01-01
  • 2014-07-15
  • 2021-12-15
  • 1970-01-01
  • 2021-07-06
相关资源
最近更新 更多