English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
You can quickly create web applications by installing Wampserver or XAMPP on your PC, which provides Apache, PHP, and MySQL database.
Here, you will learn how easy it is to create dynamic web pages using PHP. Before you start, make sure you have a code editor and some knowledge of HTML and CSS. PHP is relatively easy to pick up among many programming languages and is very suitable for beginners. However, to become a PHP expert, you need to accumulate continuously, write a lot of code, read a lot of code, and this requires a lot of practical training.
Before you continue learning, you should have a basic understanding of the following knowledge:
HTML
CSS
If you want to learn these projects first, please visit our Home Access these tutorials.
PHP scripts are executed on web servers running PHP. Therefore, before starting to write any PHP program, you need to install the following programs on your computer.
Apache Web server
PHP engine
MySQL database server
You can install them separately, or choose pre-configured software packages for your operating system (such as Linux and Windows). Popular pre-configured software packages are XAMPP and WampServer.
WampServer is a Windows Web development environment. It allows you to use Apache2, PHP and MySQL database to create web applications. It will also provide MySQL management tool PhpMyAdmin, which allows you to easily manage databases through a web browser.
For beginners, it is recommended to use integrated server components, which already include PHP, Apache, Mysql and other services, saving developers' time from the繁琐的配置环境 process.
Windows systems can use WampServer, download address:http://www.wampserver.com/, supports32and64for your system, choose the version according to your system.
The installation of WampServer is also simple, you just need to keep clicking "Next" to complete the installation.
XAMPP supports Mac OS and Windows systems, download address:https://www.apachefriends.org/zh_cn/index.html.
1, VSCode(Download from the official website)
In the past two years, it has gradually become popular, Visual Studio Code (abbreviated as VS Code / VSC) It is a free and open-source modern lightweight code editor that supports syntax highlighting, intelligent code completion, customizable shortcuts, bracket matching and color distinction, code snippets, and code comparison for almost all mainstream development languages. Diff, GIT commands and other features, support plugin expansion, and optimization has been made for web development and cloud application development. Linux, runs smoothly, and can be said to be Microsoft's good deed!
2Sublime Text3
Sublime Text is a very popular code editor at present, with the advantages of moderate size,4About 0M, runs smoothly, with rich plugins and code hinting features, it is recommended to choose the English version, the disadvantage is: it is charged, but there are many cracked versions. Sublime Text has a beautiful user interface and powerful features, such as code thumbnails, Python plugins, code snippets, etc. Sublime Text is a cross-platform editor that supports Windows, Linux, Mac OS X and other operating systems.
3、Notepad++ 7.3.1
Notepad++is a free code editor under the Microsoft Windows environment,8About M, very compact. It uses less CPU power, reduces the energy consumption of the computer system, but it is light and efficient, making Notepad++Can perfectly replace Microsoft Windows Notepad.
Now, you have successfully installed WampServer on your computer. In this section, we will create a very simple PHP script that displays the text 'Hello, world!' in the browser window.
Alright, click on the WampServer icon anywhere on the Windows taskbar and select 'www directory'. Or, you can access the 'www' directory C:\wamp\www by browsing. Create a subdirectory under the 'www' directory, let's say 'project'.
Now open your favorite code editor and create a new PHP file, then type the following code:
<?php // Display greeting message echo "Hello, world!"; ?>Test to see‹/›
Now, save the file as 'hello.html' in the project folder (located at C:\wamp\www\project), and view the result in the browser by accessing the following URL: http://localhost/project/hello.html.
Alternatively, you can access the 'hello.html' file by selecting the localhost option, and then choose the project folder from the WampSever menu on the taskbar.
PHP can be embedded in ordinary HTML web pages. This means you can write PHP statements in HTML documents, as shown in the following example:
<!DOCTYPE HTML> <html> <head> <title>PHP First Application</title> </head> <?php //Display greeting message echo 'Hello World!'; ?> </html>Test to see‹/›
You will understand the meaning of these statements in the following chapters.