PHP学习系列5

Jun 13, 2016 pm 01:12 PM
post request

PHP学习系列五
1,$_POST,$_GET,$_REQUEST---超级全局变量
$_POST,$_GET数组之一都可以保存表单变量的细节,使用哪个数组取决于提交表单时使用的方法是POST还是GET。
另外,通过这两种方式提交的所有数据都可以通过$_REQUEST数组获得
2,点号用来连接字符串
双引号和单引号
echo “$tire”:这样是输出$tire的值
echo '$tire':这样是输出$tire
3,Php可以在任何时间根据保存在变量中的值来确定变量的类型
改变变量的名称,用一个变量的值作为另一个变量的名称
如:
$varname='tireqty'
就可以用$$varname取代$tireqty,可以设置$tireqty的值
如$$varname=5;等价于$tireqty=5;

声明常量:
define('TIREPRICE',100);
echo TIREPRICE;
php预定了许多常量,可通过phpinfo()函数来查看
4,超级全局变量
$GLOBALS
$_SERVER 服务器环境变量数组
$_GET,通过get方法传递给该脚本的变量数组
$_POST,通过post方法传递
$_COOKIE,cookie变量数组
$_FILES,与文件上传相关的变量数组
$_ENV,环境变量数组
$_REQUEST,所有用户输入的变量数组
$_SESSION,会话变量数组
5,变量的赋值
在将一个变量的值赋给另一个变量的时候,先产生原变量的一个副本,然后再将它保存在内存的其他地方。可以使用引用操作符&来避免产生这样的副本。
引用就像一个别名,而不是一个指针,可以通过重置它们来改变所指向的地址。
如:$a=5,$b=&$a,$a=7;这样,$a,$b都是7了。unset($a);
恒等号(===)
只有当操作符两边的操作数相等并且具有相同的数据类型时,其返回值才为true。
new和 ->操作符,用来初始化类的实例和访问类的成员。
错误抑制操作符@
如$a=@(57/0)
如果没有@操作符,这一行代码将产生一个除0警告。使用这个操作符,这个警告就会被抑制。
执行操作符(``)
如$out=`ls -l`
类型操作符
instanceof
6,基本语法
switch中条件可以是整型,字符串,浮点型。
if(){}elseif(){};或者if(){}else if(){};
if():
endif;

endswitch,endwhile,endfor,endforeach.

do...while没有可替换的语法;
declare(directive){
block
}
用来设置代码块的执行命令。

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)

What does php request mean? What does php request mean? Jul 07, 2021 pm 01:49 PM

The Chinese meaning of request is "request". It is a global variable in PHP and is an array containing "$_POST", "$_GET" and "$_COOKIE". The "$_REQUEST" variable can obtain data and COOKIE information submitted by POST or GET.

A brief analysis of the POST method in PHP with parameters to jump to the page A brief analysis of the POST method in PHP with parameters to jump to the page Mar 23, 2023 am 09:15 AM

For PHP developers, using POST to jump to pages with parameters is a basic skill. POST is a method of sending data in HTTP. It can submit data to the server through HTTP requests. The jump page processes and jumps the page on the server side. In actual development, we often need to use POST with parameters to jump to pages to achieve certain functional purposes.

What is the Request object in PHP? What is the Request object in PHP? Feb 27, 2024 pm 09:06 PM

The Request object in PHP is an object used to handle HTTP requests sent by the client to the server. Through the Request object, we can obtain the client's request information, such as request method, request header information, request parameters, etc., so as to process and respond to the request. In PHP, you can use global variables such as $_REQUEST, $_GET, $_POST, etc. to obtain requested information, but these variables are not objects, but arrays. In order to process request information more flexibly and conveniently, you can

How to determine whether a post has been submitted in PHP How to determine whether a post has been submitted in PHP Mar 21, 2023 pm 07:12 PM

PHP is a widely used server-side scripting language that can be used to create interactive and dynamic web applications. When developing PHP applications, we usually need to submit user input data to the server for processing through forms. However, sometimes we need to determine whether form data has been submitted in PHP. This article will introduce how to make such a determination.

How to use python requests post How to use python requests post Apr 29, 2023 pm 04:52 PM

Python simulates the browser sending post requests importrequests format request.postrequest.post(url,data,json,kwargs)#post request format request.get(url,params,kwargs)#Compared with get request, sending post request parameters are divided into forms ( x-www-form-urlencoded) json (application/json) data parameter supports dictionary format and string format. The dictionary format uses the json.dumps() method to convert the data into a legal json format string. This method requires

How to use the urllib.request.urlopen() function to send a GET request in Python 3.x How to use the urllib.request.urlopen() function to send a GET request in Python 3.x Jul 30, 2023 am 11:28 AM

How to use the urllib.request.urlopen() function in Python3.x to send a GET request. In network programming, we often need to obtain data from a remote server by sending an HTTP request. In Python, we can use the urllib.request.urlopen() function in the urllib module to send an HTTP request and get the response returned by the server. This article will introduce how to use

How does java initiate an http request and call the post and get interfaces? How does java initiate an http request and call the post and get interfaces? May 16, 2023 pm 07:53 PM

1. Java calls post interface 1. Use URLConnection or HttpURLConnection that comes with java. There is no need to download other jar packages. Call URLConnection. If the interface response code is modified by the server, the return message cannot be received. It can only be received when the response code is correct. to return publicstaticStringsendPost(Stringurl,Stringparam){OutputStreamWriterout=null;BufferedReaderin=null;StringBuilderresult=newSt

How to solve the problem that NGINX reverse proxy returns 405 for POST request of HTML page How to solve the problem that NGINX reverse proxy returns 405 for POST request of HTML page May 22, 2023 pm 07:49 PM

实现如下:server{listen80;listen443ssl;server_namenirvana.test-a.gogen;ssl_certificate/etc/nginx/ssl/nirvana.test-a.gogen.crt;ssl_certificate_key/etc/nginx/ssl/nirvana.test-a.gogen.key;proxy_connect_timeout600;proxy_read_timeout600;proxy_send_timeout600;c

See all articles