Home >Backend Development >PHP Tutorial >PHP uses curl and reports parse error

PHP uses curl and reports parse error

WBOY
WBOYOriginal
2016-08-25 10:37:141355browse

This code was sent to me by my classmate

<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 uses curl and reports parse error

Exactly the same code, I pasted his code and it ran smoothly, but I typed it by hand and it ran fine

PHP uses curl and reports parse error

Excuse me, what’s going on? Thank you :-)

Reply content:

This code was sent to me by my classmate

<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 uses curl and reports parse error

Exactly the same code, I pasted his code and it ran smoothly, but I typed it by hand and it ran fine

PHP uses curl and reports parse error

Excuse me, what’s going on? Thank you :-)

There are hidden characters, I have encountered them too.

The semicolon is missing...

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn