Php 卷曲处的T_字符串错误

Php 卷曲处的T_字符串错误,php,parse-error,Php,Parse Error,当我上传我的.php时,我得到以下错误: Parse error: syntax error, unexpected T_STRING in /users/allybong/www/twitteroauth/twitteroauth/twitteroauth.php on line 201 第197-231行的脚本: function http($url, $method, $postfields = NULL) { $this->http_info = array(); $ci =

当我上传我的.php时,我得到以下错误:

Parse error: syntax error, unexpected T_STRING in /users/allybong/www/twitteroauth/twitteroauth/twitteroauth.php on line 201
第197-231行的脚本:

  function http($url, $method, $postfields = NULL) {
$this->http_info = array();
$ci = curl_init()
/* Curl settings */
curl_setopt($ci, CURLOPT_USERAGENT, $this->useragent)
curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this->connecttimeout)
curl_setopt($ci, CURLOPT_TIMEOUT, $this->timeout)
curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE)
curl_setopt($ci, CURLOPT_HTTPHEADER, array('Expect:'))
curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer)
curl_setopt($ci, CURLOPT_HEADERFUNCTION, array($this, 'getHeader'))
curl_setopt($ci, CURLOPT_HEADER, FALSE)

switch ($method) {
  case 'POST':
    curl_setopt($ci, CURLOPT_POST, TRUE);
    if (!empty($postfields)) {
      curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
    }
    break;
  case 'DELETE':
    curl_setopt($ci, CURLOPT_CUSTOMREQUEST, 'DELETE');
    if (!empty($postfields)) {
      $url = "{$url}?{$postfields}";
    }
}

curl_setopt($ci, CURLOPT_URL, $url);
$response = curl_exec($ci);
$this->http_code = curl_getinfo($ci, CURLINFO_HTTP_CODE);
$this->http_info = array_merge($this->http_info, curl_getinfo($ci));
$this->url = $url;
curl_close ($ci);
return $response;
}


这是一个Twitter“BongBot”的脚本。我是从中得到的。

您粘贴的行上缺少很多分号。这可能就是它给您一个
T\u字符串
错误的原因。

在包含以下行之后,没有一行以分号结尾:

$ci = curl_init()
尝试在以下行中添加一个,它将解决您的问题:

$ci = curl_init();
/* Curl settings */
curl_setopt($ci, CURLOPT_USERAGENT, $this->useragent);
curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this->connecttimeout);
curl_setopt($ci, CURLOPT_TIMEOUT, $this->timeout);
curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ci, CURLOPT_HTTPHEADER, array('Expect:'));
curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer);
curl_setopt($ci, CURLOPT_HEADERFUNCTION, array($this, 'getHeader'));
curl_setopt($ci, CURLOPT_HEADER, FALSE);

在许多台词之后,你错过了很多分号。这个问题与卷发或Twitter无关。这是一个PHP解析器错误。@TomvanderWoerdt Twitter,否。cURL是。@njk这是一个解析器错误,在PHP知道要使用cURL之前就发生了这种情况。错误代码的
Parse error
部分表明它与cURL完全无关。您好!现在我在“curl_init”和“curl_setopt”得到了一个“未定义函数”。但是为什么呢?@AUT_Markus听起来好像没有在PHP中启用curl。您必须确保已安装并配置扩展以使用它。我是个白痴D谢谢大家!:)新问题。现在我得到了错误警告:file_get_contents(last_update)[function.file get contents]:无法打开流:第12行的/home/u124515119/public_html/schedule_me.php中没有这样的文件或目录:$last_tweet=explode(“.”,file_get_contents(“last_update”);我不知道为什么…@AUT_Markus上次更新的文件实际上存在于
/home/u1245151119/public\u html
目录中吗?如果不是,那就是你的问题。如果是这样,它可能有许可问题;尝试使用
chmod 0774 last\u update
更新它。