"警告:输入中的意外字符"在服务器上但不在localhost上

时间:2015-03-08 20:12:49

标签: php stripe-payments

下面的条带脚本在我的localhost上使用XAMP正常工作,但是当我将它上传到我的托管服务器时,我收到了以下错误。

如何修复它以及为什么它没有在我的本地主机上显示?

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /storage/content/09/domain.com/public_html/test/pay.php on line 34

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /storage/content/09/domain.com/public_html/test/pay.php on line 34

Parse error: syntax error, unexpected T_STRING in /storage/content/09/domain.com/public_html/test/pay.php on line 34

第34行(错误发生在每个\ Stripe-line

$customer = \Stripe\Customer::create(array(

条纹脚本:

try {
        $stripePaymentData = $tool->getStripePaymentDataFromOrder($order);

        if($stripePaymentData['status']==1){

            require_once('vendors/stripe-php-2.1.1/config.php');

            $token  = $_POST['stripeToken'];
            $email  = $_POST['stripeEmail'];

            $customer = \Stripe\Customer::create(array(
            'email' => $email,
            'card'  => $token
            ));

            $charge = \Stripe\Charge::create(array(
            'customer' => $customer->id,
            'amount'   => $stripePaymentData['amount'],
            'currency' => $stripePaymentData['currency']
            ));

            $showDone = true;
            $stripeDone = true;
        }else{
            $tool->message[] = 'Payment denied, your card will not be charged. Please try again.';
        }
    } catch(\Stripe\Error\Card $e) {
      // Since it's a decline, \Stripe\Error\Card will be caught
      $body = $e->getJsonBody();
      $err  = $body['error'];
      $tool->message[] = 'Payment denied, your card will not be charged. Please try again.';
/*
      print('Status is:' . $e->getHttpStatus() . "\n");
      print('Type is:' . $err['type'] . "\n");
      print('Code is:' . $err['code'] . "\n");
      // param is '' in this case
      print('Param is:' . $err['param'] . "\n");
      print('Message is:' . $err['message'] . "\n");
*/
    } catch (\Stripe\Error\InvalidRequest $e) {
        $tool->message[] = 'Payment denied, your card will not be charged. Please try again.';
    } catch (\Stripe\Error\Authentication $e) {
        $tool->message[] = 'Payment denied, your card will not be charged. Please try again.';
    } catch (\Stripe\Error\ApiConnection $e) {
        $tool->message[] = 'Payment denied, your card will not be charged. Please try again.';
    } catch (\Stripe\Error\Base $e) {
        $tool->message[] = 'Payment denied, your card will not be charged. Please try again.';
    } catch (Exception $e) {
        $tool->message[] = 'Payment denied, your card will not be charged. Please try again.';
    }

0 个答案:

没有答案