SoFunction
Updated on 2025-04-09

The fastest understanding of PHP programming (Lecture 1: Software Environment and Preparation)

You can use it after downloading and installing it. There are many integrated development environments like this. If you have installed the PHP+Mysql development environment according to other books, you don’t need to change it after debugging. I rented the space, so it doesn't matter if I debug locally, the effect is the same.

The code writing software I use is dreamweaver. To be honest, I only use its code highlighting and CSS functions, all of the code is written by hand. You can use Notepad or Zend Studio, etc. (But don't blame me if you encounter problems, because you can also read my tutorials and programming in LUNIX, or even study on a spacecraft, provided that it does not violate the purpose of my writing of this book.)

The ftp upload tool can be used: FlashFXP, etc. These things are available on my website.

I use UTF-8 to encode PHP files, the advantage is that they are internationalized, and the code coupling between functions is good, which has an advantage over GB2312. If you want to use GB2312, you can do it, but you need to adapt to the two or three functions in this book, including files, databases, URLs, etc.

There is a line for PHP head:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
You can use the dreamweaver menu: modify --page attributes and change the page encoding to utf-8 (this is the default).
Hello world program is not provided in this book, so use this example instead:
Hello world actually uses mainly php output content functions.
<?php
echo "Hello world";
?>
Example 1: Output values ​​from 1 to 100
Copy the codeThe code is as follows:

<?php // PHP code start and end flag, equivalent to <% of asp
// The following outputs values ​​from 1 to 100
for($i = 0;$i < 100;$i++) // Like other languages, loop statements have an extra $ flag before variables, and all variables do not need to be declared.
{
echo $i . ”\r\n”;
/**
* Use the echo keyword to output to the screen, the . connector is equivalent to + in C language.
* Double quotes and escapes are the same as other languages. Using single quotes instead of double quotes will not achieve the effect of line breaking, you can try it.
*/
}
?>

Save the above code as *.php file and put it in the PHP server directory and open the path with a browser (such as: http://localhost/).
Of course, to publish a website to the Internet, you also need to apply for a domain name and space, so I won’t talk about it.