Heim  >  Artikel  >  Backend-Entwicklung  >  PHP使用curl,报parse error错误

PHP使用curl,报parse error错误

WBOY
WBOYOriginal
2016-08-25 10:37:141282Durchsuche

这段代码是我同学发给我的

<code class="PHP"><?php   $ch = curl_init("http://www.baidu.com");//初始化

  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_HEADER, 0);

  $output = curl_exec($ch);

  curl_close($ch);
  echo $output;
?>
</code>

PHP使用curl,报parse error错误

一模一样的代码,我粘贴他的代码运行出错,我照着他的代码手打一遍运行正常

PHP使用curl,报parse error错误

请问这是怎么回事?谢谢:-)

回复内容:

这段代码是我同学发给我的

<code class="PHP"><?php   $ch = curl_init("http://www.baidu.com");//初始化

  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_HEADER, 0);

  $output = curl_exec($ch);

  curl_close($ch);
  echo $output;
?>
</code>

PHP使用curl,报parse error错误

一模一样的代码,我粘贴他的代码运行出错,我照着他的代码手打一遍运行正常

PHP使用curl,报parse error错误

请问这是怎么回事?谢谢:-)

有隐藏的字符,我也遇到过。

漏了分号……

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn