Let's get to know Yaml:yaml introduction _php tutorial

Source: Internet
Author: User
Tags yaml parser

Yaml

Definition from the official YAML website (http://www.yaml.org/): Yaml is an intuitive data-data serialization format that can be read by a computer, and is easily accessible to human beings, and is easily interacted with the scripting language. In other words, Yaml is a very simple XML-like Data description language, and syntax is much simpler than XML. He is very useful in describing data that can be converted to an array or hash, for example:

$house = Array (
Family + = Array (
Name = Doe,
Parents = Array (John, Jane),
Children = Array (Paul, Mark, Simone)
),
Address = = Array (
Number = 34,
Street = Main Street,
City = Nowheretown,
ZipCode = 12345
)
);

Parsing this yaml will automatically create the following PHP array:

House
Family
Name:doe
Parents:
-John
-Jane
Children:
-Paul
-Mark
-Simone
Address
Number:34
Street:main Street
City:nowheretown
zipcode:12345

In Yaml, the structure is represented by indentation, and successive items are represented by a minus sign "-", and the key/value inside the map structure is separated by a colon ":". Yaml is also useful for describing the abbreviated syntax of data in several lines of the same structure, which is included with [], and hash is included with {}. Therefore, the preceding YAML can be abbreviated as this:

House
Family: {name:doe, parents: [John, Jane], children: [Paul, Mark, Simone]}
Address: {number:34, Street:main Street, City:nowheretown, zipcode:12345}

YAML is the abbreviation for "yet another Markup Language (another Markup language)", "Yamel", or "Jammel". This format is approximately 2001, and so far has a YAML parser in multiple languages.

Detailed specifications for the YAML format can be found on the official YAML website http://www.yaml.org/.

As you can see, writing Yaml is much faster than XML (you do not need to close the tag or quotation marks) and is more powerful than the. ini file (the INI file does not support hierarchies). So Symfony chooses YAML as the preferred format for configuration information. You'll see a lot of yaml files in this book, but it's intuitive that you don't need to delve into YAML.


http://www.bkjia.com/PHPjc/531669.html www.bkjia.com true http://www.bkjia.com/PHPjc/531669.html techarticle Yaml is the definition of the official website of Yaml (http://www.yaml.org/): Yaml is an intuitive data-data serialization format that can be recognized by computers, and is easy to be read by humans, easy to ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.