php 解析错误:语法错误,意外的 T_STRING,期待 ')'

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17200112/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 12:28:32  来源:igfitidea点击:

Parse error: syntax error, unexpected T_STRING, expecting ')'

php

提问by Ashish Srivastava

I am getting error on my site Parse error: syntax error, unexpected T_STRING, expecting ')' in /home/**/public_html/config.php on line 111

我在我的网站上遇到错误解析错误:语法错误,意外的 T_STRING,在第 111 行的/home/ **/public_html/config.php 中需要')'

My PHP code in FROM line 107 TO 112 is:

我在 FROM 行 107 到 112 中的 PHP 代码是:

 //PayPal Settings
$config [ 'paypal' ] = array(
'url' => ' https://www.paypal.com/cgi-bin/webscr ' , //url na koeto da prashta formata
'business' => 'http://startmarketplace.com/themeforestclone-demo/, / Your PayPal ID or an email address
' currency ' => ' USD ' //valuta v koqto e cenata EUR, USD etc.
);

Start line is 107. Last line is line 112.

起始行是 107。最后一行是行 112。

Line on which I am getting error is (111) is: ' currency ' => ' USD ' //valuta v koqto e cenata EUR, USD etc

我收到错误的行是 (111) 是:'货币' => '美元' //valuta v koqto e cenata EUR, USD etc

Plz help.. Thanks :)

请帮忙..谢谢:)

回答by Robinjoeh

This code should work:

此代码应该工作:

<?php
//PayPal Settings
$config [ 'paypal' ] = array(
    'url'       => ' https://www.paypal.com/cgi-bin/webscr ' , //url na koeto da prashta formata
    'business'  => 'http://startmarketplace.com/themeforestclone-demo/', // Your PayPal ID or an email address
    'currency'  => ' USD ' //valuta v koqto e cenata EUR, USD etc.
);
?>

You simply forgot to add a quote ( ' ) to the "business" key in the $config array.

您只是忘记向 $config 数组中的“business”键添​​加引号 ( ' )。

回答by Greg

 //PayPal Settings
$config['paypal'] = array(
  'url' => 'https://www.paypal.com/cgi-bin/webscr', 
  'business' => 'http://startmarketplace.com/themeforestclone-demo/', 
  'currency' => 'USD',
);