Why cannot I execute a blank line at the beginning of the php file? The file contains only nine lines.

Source: Internet
Author: User
Why cannot I execute a blank line at the beginning of the php file? There are only nine lines in the file, which cannot be understood.
Learning the chart control phplot,
The following is the code for test1.php, with only nine lines in total.
Require 'phplot/phplot. php ';
$ Data = array ('', 10), array ('', 1 ));
$ Plot = new PHPlot ();
$ Plot-> SetDataValues ($ data );
$ Plot-> SetTitle ('First Test plot ');
$ Plot-> DrawGraph ();
?>
The browser correctly displays the following chart:

-----------------
However, an execution error occurs when a blank line is added to the first line of the test1.php file. The source file is as follows:

The result of browser execution is as follows:


Reply to discussion (solution)

When a blank line is added to the first line, at least one line break is output before the image data stream.
The image is displayed based on the information provided by the image stream. if the previous content is too large, it cannot be parsed.

Thank you. how can I insert this chart into other webpages? For example, the code below is incorrect.


Require 'phplot/phplot. php ';
$ Data = array ('', 10), array ('', 1 ));
$ Plot = new PHPlot ();
$ Plot-> SetDataValues ($ data );
$ Plot-> SetTitle ('First Test plot ');
$ Plot-> DrawGraph ();
?>


-----------------------------------------
Insert the following line of code on other webpages to display the chart correctly.

But the problem is

Yes.
But the problem is that I cannot pass parameters to test1.php.


Thanks so much. you can pass parameters to the src of img. Close the post !~~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.