Mastering the basic knowledge of PHP - four kinds of delimiters

高洛峰
Release: 2023-03-05 20:18:01
Original
2104 people have browsed it

With nothing to do, I studied php, a completely different field from java and c#. PHP is (foreign name: PHP: Hypertext Preprocessor, Chinese name: "Hypertext Preprocessor"). For beginners who are learning PHP, You have to master the deployment of apache. The deployment of apache will be discussed later. Of course, there are now more one-click deployment tools for php, apache, and mysql, such as WAMP (windows, apache, mysql, php); there are many resources online. I won’t post relevant resource links here, in order to avoid the suspicion of gaining points; let’s get back to the point, let’s talk about the basic knowledge of PHP.

The four delimiters (what are delimiters?) can be understood as starting symbols and decomposition symbols. It is not difficult to understand why PHP needs four delimiters. First of all, PHP is an open source language, and its development was only developed after HTML, C#, and Java. There is no hatred without reason, and there is no love without reason. Although PHP is open source, someone still needs to pay attention to it. Most of the people who pay attention may be like us, practitioners of C# and Java. For new development languages , requires an acceptance process, so there are four delimiters on the PHP official website. Let’s learn them together, shall we? It’s not good to say it, please be brave and make a brick!

The standard writing method is also the writing method recommended by the official website. The starting number is easier to understand here. In fact, it is similar to the starting symbol of html. For beginners here, it is recommended to use the Dreamwearm tool. The I don’t want to introduce too much about the definition of dynamic pages and static pages in HTML. The difference between static and dynamic is whether to request service. The writing method is as follows:

<?php
        echo &#39;锄禾日当午&#39;;
    ?>
    <br>
    <?php
        echo &#39;床前明月光&#39;;
    ?>
Copy after login

Simple writing method , this writing method requires configuring the PHP configuration file, which is not recommended here. The specific configuration is to find the php.ini file in the PHP installation directory; how to find this file? As an experienced developer, this is not a problem for me. Generally, this file is stored in a folder with the con suffix, or directly in the root directory of the file, or the stupidest way is to add it to the header Search for *.ini in the folder, find the ini file and open it. Here to expand your knowledge, why do some configuration files end in ini? In fact, it is not difficult to understand. INI is the abbreviation of "initialization" in English. The INI file format is an informal standard for configuration files on certain platforms or software. It is composed of sections and keys and is commonly used by Microsoft. in Windows operating system. The file extension of this configuration file is mostly INI, hence the name. Open it with Notepad or editplus installed. Editplus has to be one of the must-have software for programmers, with powerful text editing functions. Search for short_open_tag in the file. I think the literal meaning of this word is easy to understand. Remove the semicolon at the beginning of this line and release the comment to modify short_open_tag=On.

    <?        
    echo &#39;锄禾日当午&#39;;    
    ?>
Copy after login

 

Asp style writing method <% %>, this is similar to the writing method of calling the background service page in asp. Those who have studied aspx.net should be familiar with this writing method, of course For this writing method to take effect, you also need to modify the php.ini configuration file. Search for asp_tags in this article, release the annotation, and modify asp_tags=On. The specific writing method is as follows:

    <%        
    echo &#39;锄禾日当午&#39;;    
    %>
Copy after login

Js style writing methodWe can also understand it as script writing method. For the understanding of script, here is the following Let me tell you a joke: why some foreigners’ works are a bit stiff when translated into Chinese. Of course, this is just my point of view. After all, I am not an English professional. Script can be understood as inserting text anywhere in the text like a foot. It is easy to understand here why js can be written at the head of html, at the tail, or even in the middle. After talking so much, here are the specific writing methods

    <script language="php">        
    echo &#39;锄禾日当午&#39;;    
    </script>
Copy after login

To master more basic knowledge of PHP - four kinds of delimiters. For related articles, please pay attention to the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!