对于那些对cyclos 3.7.3有所了解的人,我正试图让网店支付工作,但我发现错误,我得到的是错误生成票,我试图打印票然后我得到Undefined属性:
stdClass :: $在第29行的C:\ xampp \ htdocs \ cyclos_ws \ prepare_payment.php中返回。
这是我使用的代码。 谢谢你的帮助。
<?php
// Get the web service proxy
require_once 'cyclos.php';
$cyclos = new Cyclos();
$webShopService = $cyclos->service('webshop');
if (isset($_POST['user'])) {
$user = $_POST['user'];
$description = $_POST['description'];
$amount = $_POST['amount'];
$adsip = $_POST['adsip'];
}
// Setup the payment parameters
$params = new stdclass();
$params->amount = $amount;
$params->description = '$description';
$params->clientAddress = '$adsip';
$params->toUsername = '$user';
// This should be the absolute url for the page which will process the payment
$params->returnUrl = "http://localhost/cyclos_ws/complete_payment.php";
// Generate the ticket
try {
//Ensure the input parameter is named 'params' and the output, 'return'
$ticket = $webShopService->generate(array('params' => $params))->return; //line 29
} catch (SoapFault $e) {
die("Error generating a payment ticket: $e");
}
print_r($ticket);
// With the ticket ok, redirect the client to perform the payment
//header( "Location: ".Cyclos::$server_root."/do/webshop/payment?ticket=".$ticket ) ;
?>
答案 0 :(得分:0)
您在单引号中使用了变量。它应该用双引号括起来。
PHP不解析单引号,因此,单引号内的变量将被忽略。例如:
if(isset($_GET['hello'))
else if(isset($_GET['goodbye'))
else if(isset($_GET['welcome'))
双引号内的变量将在PHP中解析以检查和处理它们。
每当你在引号内使用变量时,用双引号将它们包装起来。