当前位置:网站首页>Summer precipitation Web Learning -- PHP Foundation
Summer precipitation Web Learning -- PHP Foundation
2022-07-16 05:48:00 【Wang Zui Zui】
web Learning process framework

Conceptual understanding

Data flow : After collecting data from the front end , Send to middleware , Turn the request message into a series of code that the machine can execute directly , Then give it to the back-end language processor , Take data from the database .
PHP Basics
PHP survey
PHP advantage
Doesn't matter , Every language is basically the same
PHP Application fields of
——(1) Server side script
——(2) Command line Scripter
——(3) Desktop applications
HTML Embedded scripting language
PHP Scripts can contain text 、HTML Code and PHP Code
Similar to the feeling of mixing , It can be said that the front-end code is unloaded directly php In the process of
PHP Script workflow
WEB browser
Web browser , The most commonly used client program , The main function is reality HTML Web content , Used to display the final rendered results
HTML brief introduction
PHP Workflow
Client to web The server makes a page request , If the requested resource is a static resource ( No need for dynamic generation , Original resources ), Such as 1.txt, be web The server directly returns the static page to the client (response), If you need to request a dynamic resource , Such as 1.php, You need to go through PHP Preprocessor for processing , Interact with the database server , After generating a static page , Then return to our client . So all the results we see in the browser are actually All static pages (html)
PHP Server build
PHPstudy Integrated environment
phpStudy It's a PHP The program integrated debugging environment package . The package integrates the latest Apache+PHP+MySQL+phpMyAdmin+ZendOptimizer, One-time installation , Without any configuration , It is very convenient 、 Easy to use PHP Debug environment .
One button start
Visit local 127.0.0.1
PHP Basic knowledge of
php Basic grammar
1、<?php ?> This means entering PHP Pattern , Everything outside the start and end tags will be PHP The parser ignores .(php Code and HTML Code nested with each other , Pictured )
2、 Pictured html There are two nested in the file php file , In a html Any number of... Can be embedded in the document PHP Mark !
3、PHP Languages are executed sequentially
Single-line comments //、#
Multiline comment /* */Be careful ! stay php The codes other than the start tag and the end tag are HTML Code , So want to use HTML The annotation style of , for example <!-- -->
PHP Comments in the code , Will not appear in the browser's source code
PHP The running environment is the server , What we see on the browser side is PHP Engine running PHP Execution result after code
Instruction splitter [;]
PHP Use a semicolon to indicate the end of a sentence
PHP The composition of the program
From a functional point of view , complete PHP The program can be divided into three parts : Data collection 、 Data processing and data output , among PHP Data acquisition of mainly includes three processes : Browser side data collection 、 Submission of browser side data and PHP Program data collection .
Variable name
$ The symbol represents a variable , Such as $name
① Case sensitive
② Only in letters | Numbers | Start with an underline , Cannot start with a number
HTML Front end forms ,form action Point to the server to submit url
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>C01 html</title> </head> <body> <form action="./C01.php" method="get"> user name :<input type="text" name="username"/><br/> The secret code :<input type="password" name="password"/><br/> Confirm the password :<input type="password" name="confirmPassword"/><br/> <input type="submit" value=" Submit "/> <input type="reset" value=" Refill "/> </form> </body> </html>Try opening with a web page ( Be careful , use ip Address to visit , Not directly open in browser, The former php Only then can we analyze , The latter is the opening method ) And enter the user name and password
use open in browser Words
use ip Address access
PHP The code content will be parsed
obtain C01.php?username=wzz&password=123123&confirmPassword=123123
The parameters written are submitted
So far, the data collection and submission of the browser side have been completed , One less PHP Program data collection
$userName $password $confirmPasswor Are custom variables , It doesn't matter what the name is
$_GET Used to collect data from method="get" Values in the form T The data of , In the heel userName Must follow html The parameter names in the file correspond one by one
Common arrays
【 Common arrays 】
1、$_GET[]
Used to collect data from method="get" Values in the form
2、$_POST[]
Used to collect data from method="post" Values in the form
3、$_COOKIE[]
To accept cookie value
4、$_SESSION[]
Finish right session Data reading and writing
Realization effect , The code is as follows
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title> first php Program </title> </head> <body> <?php // echo"hello,world"; // echo"<br/>"; // echo date("Y-m-d H:i:s"); $username=$_GET["username"]; $password=$_GET["password"]; $confirmPassword=$_GET["confirmPassword"]; if($password=$confirmPassword) { echo" Registration succeeded "; echo "<br/>"; echo" Your encrypted password is :"; echo md5($password); } else{ echo" The password you entered is different from the one you confirmed , Please re register "; } ?> </body> </html>

first PHP Program
phpstudy Website —— Click on the management —— Open the root directory
Create a suffix named php Of php file , use VScode open
Exclamatory mark ( In English mode )+Tab Generate template
Make a simple edit
Web page open
View page source code , Discover original php The content of the line changes , after php After the preprocessor , Turn into such a static page and send it back to me
PHP expression
PHP Operator
边栏推荐
- 操作系统笔记——Windows应急响应和安全加固
- Windows system disk slimming (Development)
- C3&H5&ES6
- BUUCTF 九连环
- Buuctf backdoor killing
- REM layout
- [Huang ah code] teacher, I want to choose software development related majors after the college entrance examination. Which direction do you think is good? How to fill in the college entrance examinat
- BUUCTF 来首歌吧
- Svelte 官方入门教程(5)—— 事件
- [Huang ah code] PHP cooperates with xlwriter to realize infinite header level excel export
猜你喜欢

BUUCTF 数据包中的线索

Mobile web development

BUUCTF 面具下的flag

Network security emergency response - electronic data forensics technology

BUUCTF 荷兰宽带数据泄露

Log blacklist can really save you money!

Memory forensics - installation and use of volatility and some CTF competition topics
![[NCTF2019]Fake XML cookbook](/img/d4/e5ff896108c86179526a06911abd38.png)
[NCTF2019]Fake XML cookbook
![[Huang ah code] getting started with MySQL - 1. SQL execution process](/img/e5/8541f9a9e260b431a4da800036ae2d.png)
[Huang ah code] getting started with MySQL - 1. SQL execution process
![[Anshi Cup 2019] Easy Web](/img/9d/f2c6fda2a96f4ac649dd553c9c2c55.png)
[Anshi Cup 2019] Easy Web
随机推荐
网络安全应急响应-恶意代码分析技术
Taobao project exercise summary
Network security emergency response - electronic data forensics technology
暑期沉淀web学习——php基础
自上而下获取父节点的id的集合
REM layout
[安洵杯 2019]easy_web
内网渗透笔记——二层发现
網絡安全應急響應-電子數據取證技術
ThreadLocal造成的内存泄漏
[Huang ah code] PHP cooperates with xlwriter to realize infinite header level excel export
使用百度轻量服务器LS遇到的一些小问题
网络安全应急响应-电子数据取证技术
[安洵杯 2019]easy_web
[Huang ah code] you must learn these little knowledge points of MySQL for beginners
Handsontable Pro authorization code key generator (JS function) (for learning and communication only)
BUUCTF 神秘龙卷风
Buuctf, let's sing a song
[Huang ah code] PHP cooperates with wechat official account to generate promotion QR code
handsontable pro 授权码 key 生成器(JS函数)(仅供学习交流)







Instruction splitter [;]











Make a simple edit 







