Laravel如何从其他应用程序获得响应?

时间:2017-08-02 05:32:30

标签: php laravel laravel-5

我必须将URL发送到另一个应用程序,以便对表单内的付款API进行付款处理。因此,当他们的网站用户点击链接时,它会将它们重定向到我的网站。但问题是当它将它们重定向到我的网站时,他们看到找不到路由错误,尽管我在web.php中有这条路线。 H如何解决这个问题?

假设我已通过表单将以下值发送到其他网站:

<input type="hidden" name="cancel_url" value="{{asset('shop-cancel/'.$tran_id)}}" />

这是我的网站的路线:

Route::get('shop-cancel/{itemid}','BillingsController@shopCancel');

3 个答案:

答案 0 :(得分:0)

而不是

  

asset('shop-cancel/'.$tran_id)

使用

  

url('shop-cancel', [$tran_id])

这提供了完全合格的路线。详细文档可以在这里找到 https://laravel.com/docs/5.2/helpers#method-url

答案 1 :(得分:0)

为您的路线命名,将其设为发布类型并使参数可选:

  # http
  <VirtualHost 127.0.0.1:80>
  DocumentRoot "C:/xampp/htdocs/clientphp"
  DirectoryIndex index.php
   <Directory "C:/xampp/htdocs/clientphp">
    Options All
    AllowOverride All
    Require all granted
   </Directory>
   </VirtualHost>

# https
   <VirtualHost 127.0.0.1:443>
DocumentRoot "C:/xampp/htdocs/clientphp"
ServerName clientphp
SSLEngine on
SSLCertificateFile "conf/ssl.crt/server.crt"
SSLCertificateKeyFile "conf/ssl.key/server.key"
<Directory "C:/xampp/htdocs/clientphp">
    Options All
    AllowOverride All
    Require all granted
         </Directory>
      </VirtualHost>

从您的VerifyCsrfToken中间件中排除此路线:

For ind = lrow To 2 Step -1
ws.Range("G" & ind).select
reportProcess = Trim(LTrim(RTrim(ws.Range("G" & ind).Text)))
If reportProcess = "Fulfillment - H/W Direct Customers (Operational)" Or reportProcess = "Revenue - Hardware" Then
    brand = "HW"
ElseIf reportProcess = "Revenue - Software" Then
    ' ~~ Check Control Point Number
    subReportProcess = Mid(ws.Range("I" & ind).Text, 12, 3)
    If subReportProcess = "201" Or subReportProcess = "202" Or subReportProcess = "203" Or subReportProcess = "204" Or subReportProcess = "205" Then
        brand = "PBS"
    Else
        brand = "SWG"
    End If
ElseIf reportProcess = "Revenue - GBS" Or reportProcess = "Revenue - GTS IS" Or reportProcess = "Fulfillment - Services(Operational)" Then
    brand = "PBS"
ElseIf reportProcess = "Revenue - TSS" Then
    brand = "TSS"
ElseIf reportProcess = "Accounts Receivable" Or reportProcess = "IBM Credit LLC - Accounts Receivable" Then
    brand = "AR"
End If

country = Trim(LTrim(RTrim(ws.Range("V" & ind).Text)))
If country = "Taiwan" Then
    geo = "Taiwan"
ElseIf country = "India" Then
    geo = "India"
ElseIf country = "New Zealand" Or country = "Australia" Then
    geo = "ANZ"
ElseIf country = "Hong Kong" Then
    geo = "Hong Kong"
ElseIf country = "Philippines" Or country = "Malaysia" Or country = "Singapore" Or country = "Thailand" Or country = "Vietnam" Or country = "Indonesia" Then
    geo = "ASEAN"
Else
    'Delete the row
    activecell.entirerow.delete
    ind = ind - 1
    goto GotoNextRecord
End If
ws.Range("B" & ind) = geo
ws.Range("A" & ind) = brand
    GotoNextRecord:
    Next ind

然后使用路线助手:

Route::get('shop-cancel/{itemid?}','BillingsController@shopCancel')->name('route.name');

答案 2 :(得分:0)

资产用于图片,css,js链接。您必须使用网址功能重定向到您的取消网址

Try This
<input type="hidden" name="cancel_url" value="{{url('shop-cancel/'.$tran_id)}}" />