Variable transmission between two web pages in PHP

zhaozj2021-02-11  196

Variable transmission between two web pages in PHP

[Author: beans teeth Add Time: 2001-5-28 22:53:08]

In the website design, we often use the user to log in to this method. After logging in, the general website will give different pages according to different users, and link to a new web page of the station or open a new web page. When we will also see that the user's information can be remembered, especially for the link or open the station after landing, there will be a greeting such as "XXX, good", and these of course In the process of logging in, the variable transmission, in the process of doing personal homepage, trying to transfer to several variables, and now discuss it. First, this is the most stupid method, but also the method I originally didn't get in touch with Session, cookie thought. This method is to transfer the variables to be transferred by the form. For example, after the user logs in, send his information such as $ username, $ ID and other information form to the next web page, of course, many cases, If you do not want to see, you can use a hidden input domain. Below is an example, assuming that $ username is sent to this page for verification as the verification, you want to pass to the next page, then create a file test4.php:

Establish TEST5.PHP: Open the Apache server, Enter http://127.0.0.1/test4.php Click on the page button, discover the value of $ username on the new web page has been transferred. Of course, the weakness of this method is obvious. It also uses a form, and if you want to refresh on Test5.php's webpage, it is obviously not very friendly. Second, use the session. Later, I found some articles about session and I feel a very good way to transfer variables at this time. By following the example: Create a new file TEST6.PHP: ";?> Establish TEST7.PHP: // Show the transferred variable When you use this method: Should be placed in the forefront of the file, that is,"

This variable can only be passed in the currently open browser, to pass in the new window, just press the following method: File: TEST8.PHP "; // Put the current session ID The value is passed to the next window. ?> File Test7.php Third, through cookie. Or by way of examples: establish a file test9.php to see ";?> file test5.php Established TEST5.PHP:

-

Use GD output Chinese character instances in PHP

-

PHP application speeds up view

-

Use XML technology to construct remote service in PHP

-

PHP and MySQL Constructive Website

-

Compilation options for PHP

转载请注明原文地址:https://www.9cbs.com/read-3887.html

New Post(0)