Questions about the delivery of URL parameters in PHP

Source: Internet
Author: User
Tags php website
About the transfer of URL parameters in PHP

Recently colleagues in the maintenance of a PHP website, this site was developed a long time ago, the maintenance of the former staff has been left, the maintenance task is now assigned to our information technology department, mainly by this colleague responsible.

Now request to move the site to a new room, so need to reconfigure a host, and then the site moved, toss a few days, everything OK, but in the test, found a problem, is all the page, if the address bar has parameters, you need to query the database, then this page will not find data, However, the database connection is normal. Initially thought is a program problem, but later found that as long as there are parameters to pass the page has this problem, so it is not a program problem, the program has not been modified, then it is only possible configuration problems, but the configuration did not find any problems, and finally can only rely on Google.

The result of the final query is that there is a difference between PHP version, some of the default open configuration is closed in php5, such as php4 before the URL of the parameter is automatically populated with the parameter name corresponding to the variable, if the URL address is view.php?id=1, Then in the view.php page can directly use $id to get the value of the parameter ID, the corresponding configuration item is register_globals, in the previous version of PHP4, the default is open, the later version is closed. So I went to the C-drive.

Locate the php.ini file in the Windows directory and the value of register_globals is changed to ON, then tested, and the problem is resolved.

For this problem a lot of time, deliberately written down so that the next time to toss.

  • Related Article

    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.