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

PHP uses curl and reports parse error

WBOY
Release: 2016-08-25 10:37:14
Original
1379 people have browsed it

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>
Copy after login
Copy after login

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>
Copy after login
Copy after login

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...

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template