简介:这是php外界PHP变量的详细页面,介绍了和php,有关的知识、技巧、经验,和一些php源码等。
class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=326450' scrolling='no'> HTML表单(GET和POST)当表单被提交给PHP脚本时,从该表单获得的变量将自动的被该PHP脚本设置为可用。请参考如下示例:
Example 5-2. Simple form variable (简单的表单变量)
当提交之后,PHP将建立一个变量“$name”,它将包含任何在表单中输入在“Name”中的内容。
PHP同时也知道如何安排表单变量的上下文关系,但是仅仅限于一次。您可以,例如,将一组变量同时叙述,或者使用这个特性来重新从多重选择输入中获得值:
Example 5-3. More complex form variables
如果PHP的track_var特性被打开了,任何关于它的结构设置或者 php_track_vars?>指示,然后经由POST或GET模式的变量提交将发觉使用全局联合数组“$HTTP_POST_VARS”和“$HTTP_GET_VARS”是合适的。
图形提交变量名字
当提交一个表单时,有可能使用一幅图象来代替标准的带标签的提交按钮,例如:
当用户点击该图象的任何位置时,相应的表单将被使用两个附加的变量(sub_x和sub_y)来传送到 服务器上。他们包含用户点击在该图形上的相应位置信息。这将包含从浏览器发出的真实变量名字(甚至包含下划线),但是PHP将会把它自动的转化成带下划线的形式。
HTTP Cookies
PHP当然的支持使用Netscape's Spec定义的HTTP Cookies。Cookies是一种在远程浏览器上存放数据的装置,用于跟踪和鉴定用户的身份。您可以使用SetCookie()函数来对cookies进行设置。Cookies是HTTP头的一部分,所以SetCookie程序必须在被进行向浏览器输出前被调用。这和Header()函数的设置是类似的。任何从 服务器送到用户处的cookies将自动的被转化成为一个PHP变量,就象使用GET和POST模式的数据一样。
如果您希望对单个的cookie分派多值,只要在cookie的名字后面简单的加上一个“[ ]”即可。例如:
SetCookie ("MyCookie[]", "Testing", time()+3600);
注意,如果不是在您的浏览器上的域或者路径不一样的话cookie将会使用相同的名字来顶替先前的一个cookie。所以,对于购物单应用程序,您可能希望保持一个计数器同时通过cookie来传送它,例如:
Example 5-4. SetCookie Example (设置Cookie的例子)
$Count++;
SetCookie ("Count", $Count, time()+3600);
SetCookie ("Cart[$Count]", $item, time()+3600);
环境变量
PHP自动的使用环境变量作为PHP的普通变量,例子如下。
echo $HOME; /* Shows the HOME environment variable, if set. */
既然信息随同GET,Post,Cookie等机制被传递进来,并且自动创建了PHP变量,有时最好是准确的从外界环境中读出一个变量以确信你正在使用正确的版本。getenv()函数就是做这个工作的,你也可以使用putenv()函数来设置一个环境变量。
“php外界PHP变量”的更多相关文章 》
爱J2EE关注Java迈克尔杰克逊视频站JSON在线工具
http://biancheng.dnbcw.info/php/326450.html pageNo:13
Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

Laravel simplifies HTTP verb handling in incoming requests, streamlining diverse operation management within your applications. The method() and isMethod() methods efficiently identify and validate request types. This feature is crucial for building

The Storage::download method of the Laravel framework provides a concise API for safely handling file downloads while managing abstractions of file storage. Here is an example of using Storage::download() in the example controller:


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Dreamweaver CS6
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software
