我正在尝试将数据发布到支付网关API.它需要xml格式的发布数据.我有以下代码:
<?php
$requestUrl = 'https://api.given.bypg'; //$block->getPaymentUrl();
$amount = 100; // $block->totalOrderAmount()*100;
$approveUrl = $block->approveUrl();
$cancelUrl = $block->cancelUrl();
$declineUrl = $block->declineUrl();
$merchant = 'mydomain.com';
//$amount = '100'; // in cents. 1$ = 100cents.
$currency = '840'; // for dollar
$description = 'Happy customers is what we make.';
$merchantId = 'Nobel106513';
?>
<?php
echo $requestUrl;
$xml_data = '<TKKPG>
<Request>
<Operation>CreateOrder</Operation>
<Language>EN</Language>
<Order>
<OrderType>Purchase</OrderType>
<Merchant>'.$merchantId.'</Merchant>
<Amount>'.$amount.'</Amount>
<Currency>'.$currency.'</Currency>
<Description>'.$description.'</Description>
<ApproveURL>'.$approveUrl.'</ApproveURL>
<CancelURL>'.$cancelUrl.'</CancelURL>
<DeclineURL>'.$declineUrl.'</DeclineURL>
</Order>
</Request>
</TKKPG>';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $requestUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); …Run Code Online (Sandbox Code Playgroud) 我正在尝试在我Ubuntu 16.04的PHP version 5.6.*.
我用过:curl -sS https://getcomposer.org/installer | php。但它给了我如下错误:
All settings correct for using Composer
Downloading...
The "https://getcomposer.org/versions" file could not be downloaded: failed to open stream: Connection refused
Retrying...
The "https://getcomposer.org/versions" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
Retrying...
The "https://getcomposer.org/versions" file could not be downloaded: SSL operation failed with code 1. …Run Code Online (Sandbox Code Playgroud) 我以前多次使用重定向回输入。但是在这个项目中我无法这样做。这是我处理表单请求的控制器方法:
public function verifyMobileCode( Request $request)
{
$userId = Auth::user()->id;
if( Auth::user()->verification_code == $request['verification_code'])
{
User::where('id', $userId)->update(['verified'=>1]);
return redirect('/')->with('success', 'Account verified.');
}
else
{
return redirect()->back()->withErrors('verification_code' ,'unv' )->withInput($request->all());
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的表单刀片:
@extends('layouts.index')
@section('content')
<div class="container" style='padding-top: 150px;'>
<?php var_dump($errors) ; ?>
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Verify your mobile</div>
<div class="panel-body">
<form class="form-horizontal" method="POST" action="{{ route('verifyMobileCode') }}">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('verification_code') ? ' has-error' : '' }}">
<label for="verification_code" class="col-md-4 control-label">Verification code</label> …Run Code Online (Sandbox Code Playgroud) 我有以下代码。它在键入后无限运行ctrl + c并执行代码的默认部分。
// Program to build a simple calculator using switch Statement
#include <iostream>
using namespace std;
int main() {
char oper;
float num1, num2;
while(true){
cout << "Enter an operator (+, -, *, /): ";
cin >> oper;
cout << "Enter two numbers: " << endl;
cin >> num1 >> num2;
switch (oper) {
case '+':
cout << num1 << " + " << num2 << " = " << num1 + num2;
break;
case '-': …Run Code Online (Sandbox Code Playgroud)