编程知识 cdmana.com

Web front end lesson 53 -- xampp, Apache, PHP Basics

1.Xampp Introduce

  ⑴ Front desk language : Used to handle user interface interactions (html、css、javascript……)

     It can be found in the browser /node Run in , Through the mechanism of parsing the foreground language in the browser ( Parser ),

     Translated into binary language for the computer to read .

  ⑵ Background language : Used to process business logic implementation (C、C++、java、php……)

     Run in server , Through the background language parser installed in the server , Translated into binary languages ,

     Common background language parser :Apache、Tomcat、Nginx

  ⑶ xampp Software , A common server integration software , Which includes Apache、MySQL、Perl Wait for the server ,

     install xampp After software , The computer can be used as the server to parse the relevant background language

  ⑷ xampp Software download :

    https://www.apachefriends.org/zh_cn/download.html

     or     https://www.xampp.cc/archives/10430

  ⑸ xampp Installation and configuration

     Ignore the warning box , Go straight to the next step to install , It's best to install it on a drive letter other than the system disk ;

     Find and run in the installation directory “xampp-control.exe”, The first run usually reports an error “……blocked port……”,

     adopt config modify “httpd.conf” and “httpd-ssl.conf” Port number in configuration file , Avoid conflicts with ports ;

     stay “httpd.conf” Modify the default... In the file 80 port (3 It's about ), stay “httpd-ssl.conf” Modify the default... In the file 443 port (2 It's about ),

     Change the default port to non conflict and easy to remember , then start function Apache The server .

  ⑹ Apache Server startup error

     Usually, after modifying the default port number as described above , Can start normally Apache The server .

     however , stay XAMPP Control Panel v3.2.4 In the version , After modification, it still can't start normally ?

     Error message “…Apache shutdown unexpected…a blocked port…”, The following is a screenshot of the exception :

  

 

    By starting... In the installation directory “apache_start.bat” file , You can see the wrong position , The screenshot is as follows :

 

   

 

 

    Open again  “httpd-ssl.conf” The configuration file , Look at the first 36 Line discovery , After listening to the port number, it is added by default “##”, The screenshot is as follows :

  

 

    Delete the... After the port number “##”, The first 36 The line should be changed to “Listen 9443”, Save and start again , Firewalls allow access to

  

     Apache Server started successfully

  

  ⑺ Access server IP Address

     Enter... In the browser IP Address “127.0.0.1:8091”,

     The default access location is Apache Install under directory “…\htdocs” Folder ,

     This folder is also the default location for program code .

2.Apache usage

  ⑴ stay WebStorm Add PHP, Set the path :File/Settings.../Editor/File Types,

     Find... On the left PHP And select , Then add... To the registration mode “*.php” File can .

  ⑵  Reset the text code , Because will WebStorm Change the project location of to “…\htdocs”,

     The text code is reset to the system default , It needs to be reset to UTF-8(3 It's about ),

     Set the path :File/Settings.../Editor/File Encodings.

  ⑶ “\htdocs” The folder is Apache Root directory ,Apache Only parse the contents of this folder , yes Apache The starting point of analysis ,

     therefore , All background files are required to be placed in this folder .

  ⑷  visit Apache The local network path of the server file :“127.0.0.1:8091”、“localhost:8091”,

     Or through cmd Use ipconfig Query local IP Address .

3.PHP Basics

  ⑴ php Mark ,PHP The file is parsed according to the starting tag (<?php) And closing marks (?>) Determine code scope ,

     Any part other than the start and end tags will be PHP The parser ignores ,

     This way of analysis makes PHP Can be nested in a variety of different documents .

     Be careful : The start tag and end tag must have a single line !

  ⑵  Separator symbol ,PHP The language needs to use a semicolon after each sentence (;) Indicates an end instruction .

  ⑶  Annotation method ,PHP Comments support C、C++、Unix、Shell And so on ,

     But it's usually used  js The style of annotation in .

  ⑷  Output method ,echo"...", This command is used to output content , And it's written in  echo The following code can be displayed directly ;

    var_dump('...'), Output information in addition to the content itself , It also includes the type and length of the data ;

    print_r(), Generally used to output arrays .

  ⑸ PHP The document must be marked with “.php” Suffixed name .

4.PHP Variable

   stay PHP in , Variables are represented by a dollar sign followed by a variable name .

   grammar :$ Variable name =value;

   The rules , Variable name and PHP The other tags in follow the same rules ,

    ⑴ A valid variable name is given by “ Letters or underscores ” start , Follow with any number of numbers 、 Letters or underscores ;

    ⑵ PHP Variable names in are case sensitive ;

    ⑶ PHP Can be used directly after the variable name is written out , Unwanted js Medium “ Declare assignments ” The process ;

    ⑷ *PHP There are always assignments between variables “ Assignment passing ”, If necessary “ Address delivery ” You need to use & Symbol ;

    ⑸ PHP The scope of variables in is function level scope ( temporary )

5.PHP Constant

   Constant , An identifier whose value cannot be changed during script execution ,

     Constants are case sensitive by default , In general, constant identifiers use uppercase .

   grammar :define(' Constant names ','value value ');

   The rules , Constant name and PHP The other tags in follow the same rules ,

    ⑴  A constant can be said to be “ Macro definition ” stay PHP An embodiment of ;

    ⑵  To distinguish between variables and constants , Constants are usually defined in uppercase ;

    ⑶ PHP Not all constants in can be changed ,MC( magic constant ) Can change .

       such as :__FILE__( file )、__DIR__( Catalog )、……

6. expression

   stay PHP Anything written in ( Valuable ) Content can be called expression .

7. Common data types

  ⑴ Boolean Boolean value

     In general use TRUE and FALSE Constants specify Boolean values , Both are case insensitive ;

     have access to “(bool)” or “(boolean)” Cast modifier , Cast a variable or expression that is not a boolean type ;

     When converted to a boolean type , The following values are considered to be FALSE:

       Boolean value  FALSE In itself

       integer 0

       Floating point value 0.0

       An empty string , And strings "0"

       An array that does not include any elements

       A special type of NULL( Include variables that have not been assigned )

     In addition to the above values , All other values are considered to be TRUE( Including any resources and NAN)

    -1 And other non 0 value ( Including positive and negative numbers ), It's all thought to be TRUE

  ⑵ Integer  Integers

     Integer values can be binary 、 octal 、 Decimal or hexadecimal ;

       Use octal to express , The number must be preceded by “0”;

       In hexadecimal form , The number must be preceded by “0x”;

       Using binary representation , The number must be preceded by “0b”

    PHP7 Previous versions , If you pass an illegal number to an octal number ( Such as 9),

       Then all the numbers after it will be ignored ,PHP7 Later versions will produce Parse Error error .

     have access to “(int)” or “(integer)” Method to cast a non integer variable or expression .

     Be careful : Do not force integer conversion on unknown scores , May lead to unexpected results !

  ⑶ Float  Floating point numbers

  ⑷ String  character string

  ⑸ Array  Array

  ⑹ Object  object

  ⑺ NULL Null value

  ⑻  The method of distinguishing variable data type :

    var_dump( Variable | expression ), Used to see the value and the type of attribution of an expression ;

    gettype( Variable | expression ), Used to see the type of a variable or expression .

8.

  

版权声明
本文为[Then meow]所创,转载请带上原文链接,感谢
https://cdmana.com/2020/12/20201225124401046l.html

Scroll to Top