JAVA programmers learn PHP

   In my spare time, I took advantage of the May Day holiday to learn PHP. They all say that PHP is the most beautiful language in the world, and it is so widely used now that it has become very popular in the programming market in a short period of time. I will learn about the trend of curiosity. , the following is the process I recorded while learning PHP, and I will share it with you;

   First of all, to do PHP, you need to download a phpStudy, which can be found on Baidu. Download it so that the php project can be run on the computer. After installation, it will look like this:

   

   This is phpStudy that has been started. It will automatically configure environment variables for you, eliminating the need for complicated configuration like java. After that, we can develop and run php projects on the computer, and then we need to use the development tools. It is atom, this is the download address: https://atom.io

  After downloading, we can write the project. The php project is very convenient to write. We only need to make a file ending with .php. For example, let's start with the most basic program:

<?php
echo "hello php!!";
?>

  The beginning of the php file must be <?php This is the php syntax specification, and the end can end with ?>, or it may not be written, which is fine. I wrote it here for the purpose of developing the specification. echo is the php output statement, or use print_r are output statements.

  PHP is not very case-sensitive, but variable names are case-sensitive, after which the variable is declared:

$a = 1;

  $ is the method of declaring a variable. To declare a variable, you only need $+variable name=assignment; here, the system will automatically determine the type of the variable. You don’t need to declare the type of the variable when you declare it like java. The method is declared in php:

function FunName () {}

  function is the keyword to declare a method, followed by the method name, if we want to call the method:

$this->FunName();

  In php -> represents the calling method, just like the principle of this.FunName in Java, just replace the . in java with ->. In addition, php code can also be written in html, just use <?php code?> to separate in html

 These are almost the basic syntax of php, and then I will learn thinkphp, which is currently the most popular framework.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325158420&siteId=291194637