Php variable assignment strange.

Source: Internet
Author: User
The php variable assignment is strange ............ what happened when I modified the program today. first, I directly assigned $ swfpath = & quot; F:/ComsenzEXP/wwwroot/docs/2012/09/10/& quot; $ pdfpath = & quot; F: the php variable assignment is strange ............
What happened when I modified the program today.
Assign a value first.
$ Swfpath = "F:/ComsenzEXP/wwwroot/docs/2012/09/10 /";
$ Pdfpath = "F:/ComsenzEXP/wwwroot/filestores/2012/09/10 /";
In this way, the program can run
But after I change the above variable to this, the program will not be able to run.
$ Swfpath = $ _ SERVER [DOCUMENT_ROOT]. "/docs/". $ file ['File _ store_path '];
$ Pdfpath = $ _ SERVER [DOCUMENT_ROOT]. "/". $ settings ['File _ path']. "/". $ file ['File _ store_path '];
The values returned by echo are exactly the same. what is the cause ....
For help

Or this program, $ page = $ _ GET ['Page']; the program is normal, but it cannot be assigned directly, for example, $ page = "[*, 0], 8 "; even though their echo values are exactly the same, it's just a ghost .......

This program is the FlexPaper php demo program. I want to embed it into my program and encounter such depressing problems.


------ Solution --------------------
1. $ _ SERVER [DOCUMENT_ROOT], because the key value is not enclosed in quotation marks to tell PHP that this is a string, a notice-level error will be generated and the subsequent header () may be thrown () A function error occurs, resulting in a warning-level error. PHP will terminate itself if an error cannot be displayed.
2. $ page = $ _ GET ['Page']; the program is normal, but it cannot be assigned directly, for example, $ page = "[*, 0], 8 ";
I don't know what the situation is?
------ Solution --------------------
Var_dump ("F:/ComsenzEXP/wwwroot/docs/2012/09/10/" ==$ _ SERVER [DOCUMENT_ROOT]. "/docs /". $ file ['File _ store_path ']);

------ Solution --------------------
Add two lines in the program header to check the error message.
PHP code
ini_set('display_errors', 'On');error_reporting(E_ALL);

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.