Home Backend Development PHP Tutorial Summary and answers to frequently asked questions about learning dynamic webpage PHP technology_PHP tutorial

Summary and answers to frequently asked questions about learning dynamic webpage PHP technology_PHP tutorial

Jul 13, 2016 am 10:58 AM
php post one Why dynamic variable exist study common problem I technology data Summary Web page answer

1: Why can’t I get the variable

I POST data name from one web page to another web page, why can’t I get any value when I output $name?

In PHP4.2 and later versions, reGISter_global defaults to off
If you want to get variables submitted from another page:

Method 1: Find register_global in PHP.ini and set it to on.
Method 2: Put this extract($_POST);extract($_GET); at the front of the receiving web page (note that there must be Session_Start() before extract($_SESSION)).
Method 3: Read the variables $a=$_GET["a"];$b=$_POST["b"] one by one. Although this method is troublesome, it is safer.

2: Debug your program

The value of a variable must be known at runtime. This is what I did, create a file debug.php with the following content:

PHP code:

Ob_Start();
Session_Start();
Echo "

";<br>
<br>
Echo "The _GET variables obtained on this page are:";<br>
Print_R($_GET);<br>
<br>
Echo "The _POST variables obtained on this page are:";<br>
Print_R($_POST);<br>
<br>
Echo "The _COOKIE variables obtained on this page are:";<br>
Print_R($_COOKIE);<br>
<br>
Echo "The _SESSION variables obtained on this page are:";<br>
Print_R($_SESSION);<br>
<br>
Echo "
";
?>

Then set: include_path = "c:/php" in php.ini, and put debug.php in this folder. You can include this file in every web page in the future and view the obtained variable names and values.

3: How to use session

For anything related to session, the function session_start() must be called before;

Paying value for a session is very simple, such as:

PHP code:

Session_start();
$Name = "This is a Session example";
Session_Register("Name");//Note, do not write: Session_Register("$Name");
Echo $_SESSION["Name"];
//Then $_SESSION["Name"] is "This is a Session example"
?>

After php4.2, you can pay directly for the session:

PHP code:

Session_Start();
$_SESSION["name"]="value";
?>

You can cancel the session like this:

PHP code:

session_start();
session_unset();
session_destroy();
?>

There is a bug in canceling a certain session variable in php4.2 and above.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631988.htmlTechArticle1: Why can’t I get the variable? I POST data name from one web page to another web page, why is $name output? but can’t get any value? In PHP4.2 and later versions, reGISter_global defaults to off. If you want to...
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to fine-tune deepseek locally How to fine-tune deepseek locally Feb 19, 2025 pm 05:21 PM

Local fine-tuning of DeepSeek class models faces the challenge of insufficient computing resources and expertise. To address these challenges, the following strategies can be adopted: Model quantization: convert model parameters into low-precision integers, reducing memory footprint. Use smaller models: Select a pretrained model with smaller parameters for easier local fine-tuning. Data selection and preprocessing: Select high-quality data and perform appropriate preprocessing to avoid poor data quality affecting model effectiveness. Batch training: For large data sets, load data in batches for training to avoid memory overflow. Acceleration with GPU: Use independent graphics cards to accelerate the training process and shorten the training time.

deepseek why can't you log in deepseek login portal deepseek why can't you log in deepseek login portal Feb 19, 2025 pm 05:00 PM

There are a variety of reasons why DeepSeek cannot log in, including server failure, network connection issues, account disables, login credentials errors, or system updates. When you cannot enter the DeepSeek login portal, users can access the official website through https://www.deepseek.com/. If you encounter login problems, users should check the server status and troubleshoot network connection or login credential errors. If the problem persists, users should contact the DeepSeek support team for further assistance.

Summary of FAQs for DeepSeek usage Summary of FAQs for DeepSeek usage Feb 19, 2025 pm 03:45 PM

DeepSeekAI Tool User Guide and FAQ DeepSeek is a powerful AI intelligent tool. This article will answer some common usage questions to help you get started quickly. FAQ: The difference between different access methods: There is no difference in function between web version, App version and API calls, and App is just a wrapper for web version. The local deployment uses a distillation model, which is slightly inferior to the full version of DeepSeek-R1, but the 32-bit model theoretically has 90% full version capability. What is a tavern? SillyTavern is a front-end interface that requires calling the AI ​​model through API or Ollama. What is breaking limit

How do you parse and process HTML/XML in PHP? How do you parse and process HTML/XML in PHP? Feb 07, 2025 am 11:57 AM

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

Why can't the Bybit exchange link be directly downloaded and installed? Why can't the Bybit exchange link be directly downloaded and installed? Feb 21, 2025 pm 10:57 PM

Why can’t the Bybit exchange link be directly downloaded and installed? Bybit is a cryptocurrency exchange that provides trading services to users. The exchange's mobile apps cannot be downloaded directly through AppStore or GooglePlay for the following reasons: 1. App Store policy restricts Apple and Google from having strict requirements on the types of applications allowed in the app store. Cryptocurrency exchange applications often do not meet these requirements because they involve financial services and require specific regulations and security standards. 2. Laws and regulations Compliance In many countries, activities related to cryptocurrency transactions are regulated or restricted. To comply with these regulations, Bybit Application can only be used through official websites or other authorized channels

PHP Program to Count Vowels in a String PHP Program to Count Vowels in a String Feb 07, 2025 pm 12:12 PM

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

Free market software app website Free market software app website Mar 05, 2025 pm 09:03 PM

This article introduces free digital asset quotation software apps and websites that can provide investors with key information such as real-time prices, price charts, transaction volume, fluctuations, market depth and news information to help investors make informed decisions. Compared with paid software, free software has the advantages of no cost, rich features, and easy operation. The article also guides users how to choose the right market software, and reminds users to pay attention to data sources, information accuracy and avoid excessive dependence, which ultimately helps investors better grasp the trends of the digital asset market. Want to know how to use free market software efficiently? Read the full text quickly!

Why is Bittensor said to be the 'bitcoin' in the AI ​​track? Why is Bittensor said to be the 'bitcoin' in the AI ​​track? Mar 04, 2025 pm 04:06 PM

Original title: Bittensor=AIBitcoin? Original author: S4mmyEth, Decentralized AI Research Original translation: zhouzhou, BlockBeats Editor's note: This article discusses Bittensor, a decentralized AI platform, hoping to break the monopoly of centralized AI companies through blockchain technology and promote an open and collaborative AI ecosystem. Bittensor adopts a subnet model that allows the emergence of different AI solutions and inspires innovation through TAO tokens. Although the AI ​​market is mature, Bittensor faces competitive risks and may be subject to other open source

See all articles